Re: WriteFile memory leak
Questions about programming are far more likely to get useful answers
if asked in a newsgroup for programmers. I infer from the functions
you use, that you are using straight Win32. And that means
microsoft.public.pocketpc.developer would be a likely candidate.
I believe Windows CE is somewhat "lazy" about garbage collection. That
could explain some apparent memory leaks.
I use CreateFile and relatives a lot, and have never seen any signs of
leaks. Although leaks specific to comm ports would have to be serious
for me to notice, given how little I use them (I mostly work with
files). More generally, these functions are used way too often for
leaks to occur without notice, and I haven't seen any reports from
anyone else. So I strongly suspect the problem lies in your related
On 22 May 2007 23:27:42 -0700, [email]email@example.com[/email] wrote:
>Hi, I've found some previous similar stuff on this, but it's of no
>I have a WinCE app (embedded Visual C++ 4.0, WinCE 5.0) that uses
>WriteFile to output data to a com port. The CreateFile is done at
>startup and CloseHandle done on quit, so the port remains open.
>Everything works great with comms a few times a second (about 15 bytes
>in and 15 out). I notice from the start that dwAvailPhys shows a slow
>decrease over time and dwMemoryLoad goes slowly up. After memory load
>is in the 90's for a while (after a couple of hours), my app goes
>weird, mainly losing screen updates and the colours all go white. Even
>restarting leaves dwAvailPhys low. It seems that after reading up on
>this, there may be a slow memory leak issue with WriteFile. Even a
>restart seems to leave memory depleted. Any suggestions on how to fix
>this, thanks, Mark.[/color]
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).
Robert E. Zaret, eMVP
20 Park Plaza, Suite 400
Boston, MA 02116