[ADOL-C] Memory problem

Kshitij Kulshreshtha kshitij at math.upb.de
Tue Apr 5 10:11:34 EDT 2011


Hello Martin,
   until ADOL-C-2.1.12 our internal memory management had some problems
with non-LIFO allocation of adoubles, this has since been changed.
Please try the svn-trunk from
https://projects.coin-or.org/svn/ADOL-C/trunk

If you still have problems, we'll be happy to look into these.

Regards
Kshitij Kulshreshtha

As on 2011-04-05 13:21, Martin Friedmann did write:
> Hi there,
> 
> I have a somewhat strange problem which may be related to my limited
> knowledge of ADOL-C, nevertheless I would very much appreciate your help :-)
> 
> Lots of memory seem to be allocated (until the program crashes) during
> runtime of the following program the program also gets increasingly slow
> during runtime. Please note that in this program never a tape is
> written, and no adoubles are allocated after calling the setup()
> function. Most interestingly, the issue goes away, if I do comment out
> the first line of setup().
> 
> I believe that this problem is caused because the automatic variable is
> allocated _before_ the huge array is allocated, but freed automatically
> _after_ creation of the array.
> 
> Any help is welcome! And yes -- I tried to google around for a while
> before asking the list..
> 
> Best regards
> 
> Martin
> 
> #include <adolc/adolc.h>
> 
> #define BLASIZE 1024*32
> 
> adouble * bla = NULL;
> 
> adouble * makeBla(){return new adouble[BLASIZE];}
> 
> void setup()
> {
>   adouble m1 = 1.0; // no problems will occur, if this is commented out!
>   bla = makeBla();
> }
> 
> void cleanup()
> {
>   deletebla;
> }
> 
> void fn(double *x) {
>   bla[0] = x[0];//t3 +t1;
>   bla[1] = x[1];//t3 - t2;
>   for(int i = 2; i < BLASIZE; i++){bla[i] = bla[i-1] + bla[i-2];}
>   return;
> }
> 
> 
> int main(void){
>   double x[2] = {0,0};
> 
>   
> 
>   setup();
> 
>   
> 
>   for (int i = 0; i < 200; i++) {
>     std::cout << i ;
>     for(int j = 0; j < 100; j++) {
>       x[0] = i * 0.001;
>       x[1] = j * 0.001;
>       fn(x);
>       std::cout << "*";
>     }
>     std::cout << std::endl;
>   }
> 
>   
> 
>   cleanup();
> }
> 
> 
> 
> 
> 
> 
> _______________________________________________
> ADOL-C mailing list
> ADOL-C at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/adol-c

-- 
Dr. Kshitij Kulshreshtha

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

Büro: A3.235

Privatanschrift:
Arnikaweg 62
33100 Paderborn.



More information about the ADOL-C mailing list