[Changseset]: Re: Memory leak with certain code
David Bateman
adb014 at gmail.com
Wed Apr 16 16:37:09 CDT 2008
dbateman wrote:
>
>
> Dmitri A. Sergatskov wrote:
>> I can confirm the problem on x86-64 linux with up to 3.0.1b version of
>> octave. I ran it with valgrind and that seems to suggest the problem in
>> sparse matrix code, e.g.:
>>
>
> Ok, then I'll take a look at it as this one seems to be my bug..
>
> D.
>
Ok the problem is to do with the fact that the sparse assign code
creates a new copy of the matrix and then assigns the lhs with this
temporary copy without clearing the indices from the original lefthand..
In fact something similar can happen with the Array class as well,
except that it makes less sense to assign the lhs with a new matrix in
that case. The solution is to call "delete [] idx" in the
Sparse<T>::operator =, and probably in the Array class as well. The
patch attached addresses this and runs through "make check" without
failure. I also no longer see the leak with valgrind.
D.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch7962
Url: https://www.cae.wisc.edu/pipermail/bug-octave/attachments/20080416/0afa2916/attachment.ksh
More information about the Bug-octave
mailing list