bug-gnu-chess
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Memory leak in Chess 5.00, 5.03 related to InitHashTable()


From: Simon Waters
Subject: Re: Memory leak in Chess 5.00, 5.03 related to InitHashTable()
Date: Thu, 14 Mar 2002 15:08:20 +0000

Sven Coenye wrote:
> 
> I would like to report a memory leak in GNU Chess 5.03 and below.
> 
> The InitHashTable function in file init.c can be called at will through
> the 'hashsize' command. However, InitHashTable() fails to free the two
> blocks of memory that were allocated for the pawn tables on the previous
> call. I have been able to verify this with memwatch and its logs report
> that 12288 bytes of memory are lost with each invocation of
> InitHashTable() (using an unmodified common.h).

Excuse my ignorance of C.

Is there any reason not to use realloc here rather than the
change suggested.

I think book.c could have done the same thing, and lose a static
variable.

Is this just some evil programming pattern left over from pre
ANSI C, or am I missing something.

Noted that cmd.c has gained an unmatched memory allocation in
inputstr, but the readline stuff defeats my understanding at the
moment.

 Simon



reply via email to

[Prev in Thread] Current Thread [Next in Thread]