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



Hi Michael,

If your VBS/ADODB code is behaving badly with regard to heap
fragmentation and you don't control the code then you can do little
except to put it in a process by itself, then periodically let that
process exit (thereby freeing all of its memory and the associated
fragmentation), then reload it. You could use a memory mapped file to
connect to it. You could use registered Windows messages to trigger
events.

In other words, put the bad actor in a sandbox, then change the sand
periodically.

Hope this helps,
-Kurt


On Sun, 16 Apr 2006 13:31:38 -0400, "Michael Evenson"
<mevenson@xxxxxxxxxxxx> wrote:

Joe,

I installed a trial copy of BoundsChecker and it found absolutely no
memory leaks. I removed the heap walker calls and put in a heapstat function
that I call instead from within the loop where I feel the memory is getting
fragmented. All the heapstat function does is traverse the heap adding up
the used and freed blocks into separate accumlators. I then output these
values every 100 times through the loop. Both accumulators keep growing in
size (about 7K for the used memory for every 100 records processed - the
freed size seems to stabalize around 500+KB). I am using the ZipArchive
library, ADODB and the VisualBasic Scripting host in the loop. The scripting
host is used to massage the output, ADODB is getting a piece of data from a
database, and ZipArchive is compressing the output record. I thought that
there might be a leak in one of these pieces, but according to
BoundsChecker, there is not. They just seem to be fragmenting the crap out
of the memory. I'm going to have to re-think the memory allocation that I'm
using, but I don't have much control over ZipArchive (but some), and I have
absolutely no control over ADODB or the VBS host engine. The count of the
number of records processed is now over 410,000 per day and growing.

Thanks for all your input. It is greatly appreciated.
Mike

.



Relevant Pages

  • Re: HeapAlloc heap fragmentation.
    ... > The problem is not one of fragmentation but one of not haveing any virtual ... > in the standard heap. ... > allocates 1-2gb of small objects, frees ALL of them and tries to allocate ... > large objects will fail due to out of memory. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Avoiding heap fragmentation in C++ program on solaris
    ... solved using Low Fragmented Heap option for the CRunTime heap. ... I was wondering If there exists a similar feature on Solaris ... Is there any way to reduce heap fragmentation in C++ ... of sense when running in early hardware with limited memory and/or ...
    (comp.unix.solaris)
  • Re: Preventing memory fragmentation
    ... >> worried about heap fragmentation. ... >> I've worried about constantly but never fragmentation. ... >The c-runtime dynamic memory manager (and most other commercial memory ... >memory is not actually freed but returned to a pool manager. ...
    (comp.lang.cpp)
  • Re: HeapAlloc heap fragmentation.
    ... memory" or search comp.softsys.matlab for the scale of the problem. ... The problem is not one of fragmentation but one of not haveing any virtual ... Because address space only goes into the heap any applictaion that allocates ... frees ALL of them and tries to allocate large ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Explorer unresponsive
    ... Jeff Stanton wrote: ... boxes before Peak Memory Usage and Virtual Memory size. ... Volume fragmentation ... Event Viewer: Event Type: Error ...
    (microsoft.public.windowsxp.basics)