Question: Memory Leak

February 24 2014 chrisc 46

1

I'm having a weird memory leak problem when I use Compiler, and numerical NAG routines for integration - at least I think it's that combination that's causing it. To see it run this:

First define the functions to use:

F_:=Compiler:-Compile(codegen[prep2trans](codegen[optimize](codegen[makeproc](convert(sinh(x)*sin(x),float),[x]))),optimize=true);

F:=proc(k)
if not (k::numeric) then return 'procname'(args) fi;
F_(k);
end proc;

INT:=proc(X) if not X::numeric then return 'procname'(x) fi; int(F(x),x=0..X,numeric,method=_d01ajc); end proc;

 

Then evaluate lots of times:

for i to 10^6 do a:=rand()/1e12; INT(a);  od:

 

And watch your computer memory go wild. I'm using Maple 17 on a new mac with 8Gig RAM, using Mavericks. It doesn't take more than a few minutes to grind the system to a halt. A restart command does not release the memory in the mserver process. [I've noticed similar problems in the past, so it's not locallised to this OS I think.]

 

On a related note, there's a problem with nested NAG integrals - in the do loop try this:

 

int('INT'(XX),XX=0..a,numeric,method=_d01akc)-int('INT'(XX),XX=0..a,numeric,method=_d01ajc);

 

it never gives zero! The problem lies in using the same NAG routine twice [here _d01ajc] for a nested integral. I've never found a way around this bug!

 

Any help would be much appreciated!

 

Please Wait...