[ADOL-C] memory issue

Kshitij Kulshreshtha kshitij at math.upb.de
Mon Sep 20 14:14:05 EDT 2010

As on 2010-09-20 19:56, Rishi Amrit did write:
> On Fri, Sep 10, 2010 at 3:55 AM, Kshitij Kulshreshtha
> <kshitij at math.upb.de <mailto:kshitij at math.upb.de>> wrote:
>     As on 2010-09-09 18:14, Rishi Amrit did write:
>     > I ran valgrind with the options you suggested. I am attaching the
>     txt report generated. There seems to be pointed to some leaks. Let
>     me know what you think.
>     >
>     > Thanks,
>     >
>     > Rishi
>     Addendum to my last mail:
>     Of course the numbers you see increasing are due to adoubles that were
>     allocated by your program or octave and not freed after trace_off() was
>     called. adoubles are only needed between the trace_on() and trace_off()
>     calls. Afterwards they must all be deleted. If adoubles exist during
>     evaluation from tape like gradient or sparse_jac, they are written to
>     the tape again during each tape evaluation. I think this is the
>     phenomenon you observe.
> I'm still trying to debug this issue. One thing that I would like to
> mention is that I am using trace_off with a an argument 1 (forcing it to
> write everything to the disk). Now when once the whole function is
> completed, I delete the tap files from the disk before calling the
> function again - which repeats the trace and then evaluate procedure. I
> observe that ADOLC-Locations_?.tab and ADOLC-Operations_?.tab file sizes
> remain the same which is perfect since the dimension of the problem is
> not changing. I'm just changing parameters. The size
> of ADOLC-Taylors_?.tap and ADOLC-Values_2 keeps on growing (even though
> I delete the files between consecutive function calls). What might be
> the reason for extra data being written. I am also attaching the header
> file which has the trace_all function that I call from my main C file to
> create tapes and then I essentially use the ADOLC drivers with these
> tapes to evaluate functions and computer jacobians and hessians in the
> optimization. You should be able to see the use of adoubles in my code.
> There are a lot of them initialized but I've taken extra precaution that
> they are deleted too -- in the last in first out fashion as suggested by
> the ADOLC manual. Let me know what you think.


The values and the taylors tape grow because not all your adoubles were
deallocated after calling last trace_off(). Deleting the tap files will
not matter, since the old adouble will be written again to the new tap
files on calling trace_on(). You need to deallocate all your adouble
arrays after calling trace_off. The valgrind trace you sent last time
had a lot of leaks originating in octave code. I suppose that's where
the adouble survive.

I'll try to run the code that you sent me through valgrind without
octave and send you the results later.
Kshitij Kulshreshtha

Institut für Mathematik,
Universität Paderborn,
Warburger Straße 100,
33098 Paderborn.

Büro: A3.235

Arnikaweg 62
33100 Paderborn.

More information about the ADOL-C mailing list