Memory issue in Mathematica 5.1 (Windows XP)

• To: mathgroup at smc.vnet.net
• Subject: [mg75019] Memory issue in Mathematica 5.1 (Windows XP)
• From: "nbm" <neeleshbmehta at yahoo.com>
• Date: Sat, 14 Apr 2007 01:10:02 -0400 (EDT)

```Hi,

A memory leak problem.

I am running the following code on Mathematica 5.1 on a Windows XP
machine.

I find that the memory in use increases everytime the following
function is run. I don't understand why. Can anyone kindly explain?

This function is part of a larger program. I am basically running into
a memory used up problem after I run several iterations in the large
program. I suspect the above memory leak to be the cause of the
problem. Hence, this request.

Sorry for the uncommented code. (Expon is an array that is fed to
PdfSum.)

PdfSumExp[Expon_,x_]:=
Module[ {f,N,i,L,temp,temp1,j,k,Exponents},
(* Print["PdfSumExp"]; *)
(* Print[MemoryInUse[]]; *)

Exponents = Sort[Expon];
N = Length[Exponents];
L = Range[N];
For[i=1, i<N, i++, (
If[Exponents[[i]]==Exponents[[i+1]], Print["equal exponents"]];
)];
temp = 1;
For[i=1, i<=N, i++, (
L[[i]] = 1/Exponents[[i]];
temp = temp*L[[i]];
) ];
f = 0;
For[j=1, j<=N, j++, (
temp1 = 1;
For[k=1, k<=N, k++, (
If[k ==j, Continue[]];
temp1 = temp1*(L[[k]]-L[[j]]) ;
)];
f = f + Exp[-L[[j]]*x]/temp1;
)];
f = temp * f;

Clear[Exponents,N]; (* nbm *)

(* Print[MemoryInUse[]]; *)

Return[f];
];

Regards,

Neelesh.

```

• Prev by Date: 2D cellular automata (non-totalistic)
• Next by Date: Re: Problem wit cubic spline
• Previous by thread: Re: 2D cellular automata (non-totalistic)
• Next by thread: Printing Notes