Re: How to release heap memory that is marked as 'free'



Ajay,

Actually the memory does still belong to the process, but has been freed.
Apparently Windows does not reclaim the freed memory from the heap until it
is needed. This is all well and good except that , if Windows cannot find a
large enough contiguous block of memory upon a request for allocation, it
prefers to use virtual memory over doing a garbage collection to find more
memory. The freed memory becomes part of my process's 'working set'.
Eventually, my process consumes so much memory in it's working set (which
is marked as free since there is no leak) that all other process running on
the machine have to get their memory from the virtual memory pool.

I remember that there is a way to force Windows to reclaim the freed memory,
but it invovles something to do with forcing the process to swap to disk.
When this happens, all of the memory allocated to the process is garbage
collected and the freed memory is returned to Windows. I just canot remember
how to force the process to swap. I remember having to get the process ID of
the application and doing some system call to force it out of memory (I
think).

Mike




"Ajay Kalra" <ajaykalra@xxxxxxxxx> wrote in message
news:1144934421.595893.228090@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
it shows a VERY large amount of memory that is free but has not been
returned to
the operating system.

How do you figure this? That would mean that your process is still
using that memory.


---
Ajay



.



Relevant Pages

  • Re: HOW IS Memory Used by a VB App
    ... in memory and how does a virtual memory operating system like>Windows ... move lengthy strings to a resource file or other file. ... On a macro level both VB and Windows are doing their thing. ... you should reclaim the space used by these variables as soon as you ...
    (microsoft.public.vb.general.discussion)
  • Re: Garbage Collection
    ... Garbage collection is when freed memory is marked as unused but remains ... and you can always use pointer and manual allocating... ...
    (borland.public.delphi.non-technical)
  • Re: Malloc/Free - freeing memory allocated by malloc
    ... Dan Pop wrote: ... > The freefunction typically doesn't touch the contents of the memory it ... > the freed memory will crash your program. ... > memory before allocating it to another program. ...
    (comp.lang.c)
  • Re: How to release heap memory that is marked as free
    ... Reducing the amount of physical memory is what I am trying to do. ... Windows to reclaim the freed blocks of memory that belong to the process's ... if the memory has been freed that Windows ...
    (microsoft.public.vc.mfc)
  • Re: How to release heap memory that is marked as free
    ... Code and using managed objects will you see any form of garbage collection. ... The memory is *not* part of the working ... This is what the Virtual Memory Manager does, and there's no reason you need to do ... The freed memory becomes part of my process's 'working set'. ...
    (microsoft.public.vc.mfc)

Loading