Mem usage in Mac OSX

Ken Thomases ken at
Tue Oct 3 01:09:32 CDT 2006

On Oct 2, 2006, at 12:49 PM, Robert Shearman wrote:

> Nick Burns wrote:
>> All the following have this VM ~=4GB on startup -- its not a  
>> leaking problem... (afaict)
>> OGL/D3D -- WinRAR, GTAVC, Tribes2, (FlatOutDemo -- even thou it  
>> dies on startup now -- still gets to ~4GB), SHOGO
>> NON-GL -- cmd (not even using X11), winecfg, StreamDown, MS VC++  
>> 6, MS+Connentix VPC (even thou it uses a driver and will not start  
>> correctly), Shogo (start screen)
>> ---
>> It just plain takes too much mem -- then dies due to the OS  
>> saying more....
>> (I will have to test top at some point...)
>> Does Linux have the same mem problem? -- does top show like 4GB of  
>> VSIZE on app start?
> The numbers seem bogus since 32-bit apps can only take up 4Gb of  
> VM. Wine does reserve 1.5Gb of VM on startup to ensure no system  
> libraries are present in the area needed for Win32 apps and libraries.

And Mac OS X reserves another ~0.5GB of the VM address space for  
"submaps".  These are areas of VM that are reserved for the system  
libraries to be loaded into.  See the "-submap" explanation in the  
man page for the vmmap tool: < 

In fact, vmmap is useful for investigating this issue.  The command  
"vmmap -interleaved -w -submap <pid>" will show you the submaps.   
Note that the submap address ranges overlap the specific loaded areas  
that follow them.  Adding "-allSplitLibs" will show the way the  
submaps are divided up among libraries that aren't loaded but might  
be.  This also includes the unused split libraries in the subtotals  
at the end of the report.

Running notepad and applying vmmap shows only about 95MB of unused  
split libs.  So, apparently, the half gig in submaps is actually  
mostly used.

The other really big chunk of VM (after Wine) is labeled as "STACK  
GUARD".  I believe the intent of STACK GUARD space is to generate  
exceptions (EXC_BAD_ACCESS / SIGSEGV) if a stack grows beyond its pre- 
allocated bounds.  It's another 1.5GB!  This seems like the real  
culprit.  I think STACK GUARD pages should only show up in single- 
page areas (4K) on either side of a stack.  I'm seeing huge areas  
(~240MB, ~250MB, and ~1GB).  There's only one actual stack showing.   
It's 8MB, between the 250MB guard and the 1GB guard.

Checking a normal Mac app (Mail) shows no such huge STACK GUARD areas  
-- just a single 4K page below each actual stack.

I have no idea what's creating these huge stack guard areas.


More information about the wine-devel mailing list