What is all this uncommitted reserved memory in my process?

I use VMMap from SysInternals to look at the memory allocated by my Win32 C ++ process on WinXP, and I see a bunch of allocations where parts of the allocated memory are reserved but not committed. As far as I can tell, from my reading and testing, all common memory allocators (for example, malloc, new, LocalAlloc, GlobalAlloc) used in a C ++ program always allocate completely blocked memory blocks. Heaps are a common example of code that reserves memory, but does not commit it until needed. I suspect that some of these blocks are Windows / CRT heaps, but there seem to be more such blocks than I would expect from a heap. I see about 30 of these blocks in my process, ranging in size from 64 to 8 MB, and I knowthat my code never intentionally calls VirtualAlloc to allocate reserved uncommitted memory.

Here are some examples from VMMap: http://www.flickr.com/photos/ 95123032 @ N00 / 5280550393 /

What else would such memory blocks allocate where most of them are reserved but will not be executed? Would it make sense that my process has 30 heaps? Thank.

+5
source share
3 answers

I understand - this is a bunch of CRT, which is distributed by call malloc. If you allocate a large block of memory (e.g. 2 MB) with malloc, it allocates one fixed block of memory. But if you select smaller chunks (say 177kb), then it will reserve 1 MB a piece of memory, but only copy about what you requested (for example, 184kb for my 177kb request).

, 1 . , 4k, , 1 - . malloc, 1 , . , , ( 1 2 ). , .

, _heapmin. , , , , , heapmin , (?), . , heapmin ( ), malloc , . Windows/32 XP, .

UPDATE: heapmin . malloc 512kb. malloc MB , 512kb. , , malloc 2- , . heapmin , , .

+7

DLL ? DLL ( ) , . , . ( ), -.

, , . , .

, , VMMap.

0

, , () . , . , .

, .

The practical consideration is that reserved memory is a hard limit on the size of the stack, which reduces the address space available to the application. However, only fixing part of the reserve, we do not need to consume as much memory from the system as necessary.

Therefore, each thread may have a portion of reserved uncommitted memory. I'm not sure what the page type will be in these cases.

0
source

All Articles