Re: How much VM is available to a process?
Re: How much VM is available to a process?
- Subject: Re: How much VM is available to a process?
- From: Pelle Johansson <email@hidden>
- Date: Wed, 28 May 2003 13:56:29 +0200
onsdagen den 28 maj 2003 kl 07.53 skrev Rob Clevenger:
I have a user app that is a memory hog. When I view it in "Process
Viewer" I see that it consumes close to 3 gb of virtual memory before
the program complains about not enough memory. Is there a way to bump
up the amount of VM available or is this a hard limitation (based on
number of address bits maybe)?
The whole 32 bit address space (4GB) is available for usage. However,
your program and those of all loaded shared libraries and the stack(s)
take up some space. The biggest amount of memory you can allocate with
malloc() is about 2.5 GB, because malloc() needs a continuous hole and
after that it runs into allocated space. You can still allocate the
rest of the address space using vm_allocate() directly though.
If you need more than 4 GB, you'll have to use some trick. The easiest
is probably to use several processes to do the work. They can even
write into each other's address space using vm_write() (or temporarily
map it up). Another way is creating several temporary files and mmap()
one of them. Then when it runs out switch to a new file. The problem is
of course that before every data access in this part of the memory
you'll have to make sure the correct file is the one mapped.
--
Pelle Johansson
<email@hidden>
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.