Re: LocalFree Fails to Release Memory

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Let's see. If you call LocalAlloc() from managed code, that allocates from
the local heap. If you grow that heap really, really big and then free some
objects, does any of the memory get released to the OS? Or just back into
the free part of the local heap?

Since you're allocating so much stuff, I'd try creating my own heap using
HeapCreate() and do the allocs and frees using HeapAlloc() and HeapFree(),
and, if I need to dump everything in a low-memory situation, free that heap
entirely with HeapDestroy().

Paul T.

"<ctacke/>" <ctacke_AT_OpenNETCF_com> wrote in message
news:%23ficYFGgGHA.3652@xxxxxxxxxxxxxxxxxxxxxxx
You are most certainly doing it wrong. You need to find the source of the
leak and plug it. What you're doing is a recipe for poor performance and
absolutely no gain.

-Chris


"Giorgos" <steilemoy@xxxxxxxxx> wrote in message
news:1148601857.061708.6710@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Now it's getting a bit confusing. The problem is that after using the
pocket pc for some time, available RAM decreases even though
applications are closed down. This memory gets released after a soft
reset.

I read about the memory management, (WM_Hibernate etc.) and my idea was
to force the system to release as much memory as possible, by taking up
all available memory, waiting for some time and then releasing it. It
really works but as I said earlier, the memory gets released after I
close my application. This way I cannot inform the user about how much
memory gets free after running my program. Also when I allocate the
memory in big amounts (1 mb instead of 1kb) the system does not
respond... ( I hope you can understand what I am saying).

I realize that what I am trying to do is probably 'immature'
programming, but I am really new to this. Please let me know if I am
doing things in the wrong way. I will start reading more about memory
management and maybe find the right way to do it ! Thanks for your
suggestions. The keywords in your reply will help me a lot.





.



Relevant Pages

  • Re: C++ Garbage Collector on VMS?
    ... LIB$<tree management> calls. ... programmers have had to worry about memory management ... VMS is certainly not "the only OS that actually has" such primitives. ... they may not have introduced them for application-level heap management). ...
    (comp.os.vms)
  • Re: C++ Garbage Collector on VMS?
    ... Examples of these primitives are the LIB$<tree management> calls. ... Now look at the market size for VMS - tiny compared to Unix/Linux, Windows, and Mac. ... A quick look at the LIB$ VM routines suggests that they don't do anything in the way of GC: they just seem to allow the application to break up its dynamic virtual memory use into multiple heaps and exercise some degree of control over how those heaps are managed. ... But that doesn't relieve the programmer of deallocation responsibility: it just potentially makes heap management more efficient. ...
    (comp.os.vms)
  • Re: Whats the difference between the heap and the freestore?
    ... > In general, when discussing dynamically allocated memory, I hear people ... As of a couple of days ago, I though the heap ... pool of memory from which a C++ program allocates storage for dynamic ...
    (comp.lang.cpp)
  • Re: Quick question on the Managed Heap
    ... Right - so in other words not all of the application's heap space is ... > memory management can get quite complex. ... string and one ...
    (microsoft.public.dotnet.framework.interop)
  • Re: simplest dynamic memory manager / allocator
    ... You might find that 4tH doesn't reserve much memory for dynamic ... memory is allocated at the heap, ... 768 allocates 64 bytes. ... Every fragment is represented by a cell in the HAT. ...
    (comp.lang.forth)