LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   How to allocate a region of memories which similar VirtualAlloc (https://www.linuxquestions.org/questions/programming-9/how-to-allocate-a-region-of-memories-which-similar-virtualalloc-882044/)

GiangNV 05-21-2011 10:29 PM

How to allocate a region of memories which similar VirtualAlloc
 
Hello.

I was looking for a method of allocating memories on Linux which similar VirtualAlloc on Windows. Requirements are:

1. Size of memories block to allocate is 2^16.
2. Address of memories block is larger than 0x0000ffff
3. Address of memories block must have last 16 bits are zero.

On Windows because lower limit of application address (lpMinimumApplicationAddress) we have (2) obvious right. From (1), (2) and system rules we also achieved (3).

Thanks for helping.

dugan 05-21-2011 10:50 PM

Why?

This (previously posted) might help:

http://forums.pcsx2.net/Thread-blog-...Alloc-on-Linux

GiangNV 05-21-2011 11:10 PM

I'm trying to implement memory pooling. Which each chunk meets requirements above I can get pointer to this by (blockPtr & 0xffff0000). This is useful when deallocate a block.


All times are GMT -5. The time now is 01:24 PM.