[SciPy-user] Weave Memory Leak?
prabhu_r at users.sf.net
Wed Oct 20 02:39:01 CDT 2004
>>>>> "GN" == Greg Novak <novak at ucolick.org> writes:
GN> A few days ago I wrote the list about a memory leak in code
GN> involving Weave. Now I'm ready to run it up the flagpole.
GN> I've put the code here:
GN> The problem is in the integrate() python function. If I
GN> replace it with code that doesn't use Weave (just returns
GN> reasonable fake data), there's no memory problem.
I have no clue if this will help but I took a *very* quick look and
noticed that you allocate using dvector in test_derivs but don't call
free_dvector before you return. You call test_derivs from eval_derivs
Try this version of test_derivs instead:
def test_derivs(eqns, yi, params, recompile):
"""Make sure that the derivs function can be evaluated"""
code = r"""
double *dys = dvector(1, Nyi);
int res = derivs(0, yi-1, dys, params-1);
free_dvector(dys, 1, Nyi);
return_val = 1;
return_val = 0;
return weave.inline(code, ['yi', 'params'],
I haven't tested but my guess is that this is a top candidate for a
slow but sure memory leak.
Could that be it?
More information about the SciPy-user