www.delorie.com/djgpp/faq/memory/malloc-not-physical.html   search  
I did malloc(50*1024*1024), but didn't see any paging happen, and I only have 8 MBytes of RAM on my machine. Is this virtual memory thing for real?

I malloc()'ed a large chunk of memory, but when I check values returned by _go32_remaining_physical_memory(), I don't see any change...

When I free() allocated RAM, _go32_remaining_physical_memory() reports there was no change in available RAM.

In non-DPMI modes, go32 only pages in memory when it is actually accessed. If you only malloc() it, but don't access it, it won't grab those pages. Try calloc() and see the big difference. When you call free(), go32 doesn't return memory to the system, it just adds it to its internal pool of free pages. So, from the system point of view, these pages are not ``free''.

  prev   next     webmaster   donations   bookstore     delorie software   privacy  
  Copyright © 1995   by DJ Delorie     Updated Feb 1995  

Please take a moment to fill out this visitor survey
You can help support this site by visiting the advertisers that sponsor it! (only once each, though)