Memory problem

Hello Rooters

I’m running a named script, that produces a rather large matrix. When I open the task manager and look at the swap file, I realize that the used memory increases every time I run the script and doesn’t drop until I close Root. How can I free the memory after running the script without closing Root?

I have to use that because I wrote a small simulation which uses a lot of memory (more than my laptop possesses). Therefore I divided the simulation in several runs. But this of course only helps if the memory is freed after each run.
I’m looking for a command like this:

[code]void prog(){
Int_t nruns=100;
for (Int_t i=0;i<nruns;i++){
function();
//here I want the “free memory command”
}
}

function(){
//function that does some calculations
}[/code]

Thanks in advance for your help…

Cheers

Christian[/code]

It all depends on what function() does (e.g., newing memory and not deleting it, etc). Without more information, I don’t think anyone will be able to give much help. I’m sure the Root people will ask you to post a small but working example.

Cheers,
Charles

Hello

I was able to solve the problem. I wanted to write a small example in order to show my problem, and then by writing the small example I realized where the problem occurs:

void bbb(){ Int_t nruns=100; for(Int_t i=0;i<nruns;i++){ function(); } } function(){ const Int_t n=1E6; TPolyMarker3D *pm = new TPolyMarker3D(n); for (Int_t i=0;i<n;i++){ pm->SetPoint(i,gRandom->Gaus(),gRandom->Gaus(),gRandom->Gaus()); } //delete pm; }

I didn’t add the line
delete pm;
before and then I had the problem that the swap file just kept on increasing…

Cheers

Christian

:smiley: