Mombu the Programming Forum

Go Back   Mombu the Programming Forum > Programming > Memory leaks, Virtual Memory & GlobalMemoryStatus
User Name
Password
REGISTER NOW! Mark Forums Read




Reply
1 27th March 22:34
junkmails
External User
 
Posts: 1
Default Memory leaks, Virtual Memory & GlobalMemoryStatus



Hi,

Mem Leaks/Virtual Memory Loss/WinCE

Does anybody know of any memory leaks in WinCE Pocket PC 2003 api or
on BT Dlls.

I use Pocket Print HTML DLLs for my Blue tooth printing requirements
and after every call to the print, I notice a loss of atleast (usually
a multiple of) 65536 bytes of virtual memory. I traced this using
available virtual memory GlobalMemoryStatus.

I used Entrek CodeSnitch to detect if there are any leaks, but couldnt
find any substantial evidence of memory leaks. The dll vendor also
claims that are no leaks reported by codesnitch in their s/w. I tried
sample programs to find if I m losing memory as a result of
loadlibrary / freelibrary. They seem to be OK.

In relation to the same, Can anyone educate me what exactly does
virtual memory represent. From what I have read, I understand that the
OS makes available about 32 MB in WinCE for use by the process
abstracting the physical location of the memory.

During the execution of my program, the program steadily decreases in
virtual memory and when it less than 65536 bytes it crashes.Is there a
way to reclaim lost virtual memory programmatically?

In my future development, i am sure i would be required to use many
3rd party dlls and memory leaks in the dlls would be out of my
control. What is the best way to contain virtual memory loss and
prevent my application from crashing even during long runs.

Can anyone help?

Thanks.

regards,
Praveen
  Reply With Quote


 


2 27th March 22:34
andrej_köhler
External User
 
Posts: 1
Default Memory leaks, Virtual Memory & GlobalMemoryStatus



Hello,

Each prozess on WinCe gets 32MB virtual address space from the OS.
Each allocation on the heap, your executable and all dll that you may
load are placed or mapped in this 32MB space.
This means if you load a lot of Dlls or do frequently
allocations/dealocations the virtual address space gets fragmented and
even you still have a lot of physical memory the allocation could fail
bacause your virtual address space is full.

here you can find a very good article
http://msdn.microsoft.com/library/de...advmemmgmt.asp
there is everything described in better english and also some
solutions/workarounds

Regards, Andrej
  Reply With Quote


 


Reply


Thread Tools
Display Modes




666