Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Statistics needed on memory leaks for chess programs

Author: KarinsDad

Date: 20:53:52 12/28/98

Go up one level in this thread


On December 28, 1998 at 22:23:58, Robert Hyatt wrote:

>
>
>I don't follow any of this.  IE in crafty, I "malloc()" the hash tables, I
>do _not_ free() them before I exit(0) the program.  And the memory gets freed
>up under windows just as it does under linux.  Yes I can create a thread and
>so long as a thread "lives" its resources remain allocated.  But I don't know
>of commercial chess programs that create threads so don't see where this is a
>problem.
>
>this "object" discussion loses me.  An object (in C++) is not a permanent thing
>that exists 'on its own'... it is simply a data structure that comes into being
>when you access an object constructor, and disappears when you access the
>destructor...  but when the program terminates, the objects disappear along
>with it...

Robert,

You're absolutely correct. That is how it is supposed to all happen (in theory).
And memory allocation and creation of your own objects where those objects are
autonomous (i.e. do not make calls to other external resources such as a
service) does work like that (a service could fail, for example, if it had it's
own memory leak and since it is still in memory, it could hog resources, but
this is a totally different thing). However, there have been (mostly in the
past) instances when calling API calls such as some of the MFC calls where some
other resources do not get recovered (I believe WinSockets had the problem at
one time). Microsoft fixes these problems when they are reported and puts the
fixes into their next service packs. However, this post started due to someone
reporting a resource leak in a chess program which did not get cleaned up by
Windows 95, hence, the possibility that other chess applications (engines,
databases, or training programs) could have found one or more of these rare
leaks that one or more of the OSs misses was possible.

I did some of my owning testing on Windows NT 4.0 (with service pack 4) today
and could not reproduce a memory leak that did not get cleaned up by the OS when
the application exited (I tried "losing" about a dozen different types of MFC
objects and also a new()). I'm sure that there are some obscure ones still out
there, but for the most part, this issue is probably moot at this point unless
someone finds something on one of the earlier OSs.

KarinsDad



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.