Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Memory leakage?

Author: Gerd Isenberg

Date: 11:16:25 10/05/05

Go up one level in this thread


On October 05, 2005 at 11:22:56, TEERAPONG TOVIRAT wrote:

>Hi,
>
>How do I know my chess program on Windows has memory leakage or not? I’m
>worrying about this because from time to time when I open many windows and run
>my program for a while, I can see changes in font size in my program which
>return to normal after I close other programs.  Or, this is a bug in handling
>font in my program?  If this is memory leakage, what is the most likely cause?
>Any help is appreciated.
>
>Regards,
>Teerapong

Hi Teerapong,

hmm, not quite sure about your problem with the symptoms you describe.
Assuming you are using C/C++, may be you have some problems with win-gdi
objects, like Brushes, Pens, Fonts etc.. There are api-functions to create those
objects, to select those object in a current device context (you have to keep
track of the previous selected object), to reselect the previous pen/brush/font
or whatever and finally to destroy your gdi-objects not longer needed.

Usually memory leaks occur if you don't free/delete dynamic memory allocated by
*alloc/new. In the Debug-version of mfc-apps, new-operator is defined as
DEBUG_NEW and keeps track of all allocated objects.
If your mfc-program terminates without "deleting" those objects it reports
memory leaks in the debug-window with source lines where the new-operator
occured.

Here are some further tips (try google as well) :

http://www.flipcode.com/articles/article_memoryleaks.shtml

Another idea is to use Java and Swing ;-)

Gerd



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.