Computer Chess Club Archives


Search

Terms

Messages

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

Author: Vincent Vega

Date: 18:45:51 06/06/01

Go up one level in this thread


>
>
>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...

One important situation when it's good to free the buffers explicitly is if you
can expect that these functions will be used inside a larger program.  And if
you publish any useful stuff on the Web, you can be pretty much sure that
somebody will do just that.  Of course all that is avoided by using a language
with garbage collection (or using a garbage collector with C/C++)...



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.