[Top][All Lists]

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

Re: [gnugo-devel] bugs report

From: bump
Subject: Re: [gnugo-devel] bugs report
Date: Fri, 11 Jul 2003 14:56:31 -0700

Paul wrote:

> >   if (dragon2 != NULL)
> >     free(dragon2);
> >
> >   dragon2 = malloc(number_of_dragons * sizeof(*dragon2));
> >
> > If indeed as Pcibus claims there is some reason dragon2 can't
> > be deallocated, I guess this is a real example of a memory
> > leak. Unlike the hash table and owl stack, malloc is called
> > every move on this one.
> it works just as written: it reallocates dragon2[].  it never
> frees the array.

Why not?

The call to free should be executed once every move cycle,
so the block will be deallocated except for the very last
dragon2 that is allocated.

>From the libc doc:

>  - Function: void free (void *PTR)
>      The `free' function deallocates the block of memory pointed at by
>      PTR.


reply via email to

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