3

Keep the size of the address space to 4 GB in 64 bits

 3 years ago
source link: https://www.codesd.com/item/keep-the-size-of-the-address-space-to-4-gb-in-64-bits.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Keep the size of the address space to 4 GB in 64 bits

advertisements

I want to keep some applications to run with a 4 GB address space within a 64 bit OS running on a 64 bit processor (x86 xeon, 8 core). I know there is an option to compile with -m32 option, but at this moment the computer I'm working with, doesn't have the required support for compiling with -m32, so I can't use it, neither I can install anything on that computer as I don't have any rights.

Now my question is if there is any possibility to restrict address space to 4 GB. Please don't ask me why I want to do so, just tell me how if that is possible. Thanks.


The ulimit/setrlimit mechanism, accessible in bash via ulimit, can do this with minor drawbacks.

ulimit -v 4000000

should limit the memory available to the current process group to 4 GB.

However, it limits the total size of your address space mappings, and does not limit your mappings' offset - you still may have pointers larger than 2^32.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK