Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Getting rid of memory leaks using Nalimov's code

Author: Marcus Heidkamp

Date: 01:01:23 06/06/01

Go up one level in this thread


On June 05, 2001 at 14:20:35, Robert Hyatt wrote:

>On June 05, 2001 at 11:59:58, Daniel Clausen wrote:
>
>>Hi
>>
>>On June 05, 2001 at 11:18:55, Robert Hyatt wrote:
>>>
>>>I'm not sure I follow here.  Once he allocates buffers, they are needed until
>>>the program terminates.  It is a total waste of time to free things just before
>>>you terminate as that causes the "free" stuff to be done _twice_.  Once by
>>>the C library to your virtual memory address space (for the free() calls) and
>>>then once by the OS to mark the entire program's physical addresses as "free"
>>>when it terminates...
>>
>>It's considered good practice to put the toys back on the shelf after playing
>>with them. [as opposed to waiting for mom to do the job]
>>
>>Regards,
>>
>>Sargon
>
>
>It isn't considered a good practice by me...  unless you are going to free
>things then run a while longer.  But if you are going to free and immediately
>exit, it is more efficient to just exit, for the reason I already gave.

I think the discussion of right or wrong does not hit the point. If you feel
confortable with not freeing up the memory then don't do it. On the other hand:
freeing it up "twice" on program exit won't cost much performance. I just like
to "put the toys back on the shelf after playing with them", as Daniel said.

Marcus



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.