[Changseset]: Re: Memory leak with certain code
John W. Eaton
jwe at bevo.che.wisc.edu
Wed Apr 16 16:44:44 CDT 2008
On 16-Apr-2008, David Bateman wrote:
| 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.
I applied it.
Thanks,
jwe
More information about the Bug-octave
mailing list