Re: LocalFree Fails to Release Memory
- From: "Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT com>
- Date: Fri, 26 May 2006 09:32:23 -0700
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.
.
- References:
- LocalFree Fails to Release Memory
- From: Giorgos
- Re: LocalFree Fails to Release Memory
- From: Paul G. Tobey [eMVP]
- Re: LocalFree Fails to Release Memory
- From: Giorgos
- Re: LocalFree Fails to Release Memory
- From: Paul G. Tobey [eMVP]
- Re: LocalFree Fails to Release Memory
- From: Giorgos
- Re: LocalFree Fails to Release Memory
- From: <ctacke/>
- LocalFree Fails to Release Memory
- Prev by Date: Re: TraceEX and TraceListener...any code examples?
- Next by Date: Re: LocalFree Fails to Release Memory
- Previous by thread: Re: LocalFree Fails to Release Memory
- Next by thread: Re: LocalFree Fails to Release Memory
- Index(es):
Relevant Pages
|