Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   API/C memory mananegemnt problem (http://www.velocityreviews.com/forums/t355320-api-c-memory-mananegemnt-problem.html)

fumana@lambrate.inaf.it 03-10-2006 08:19 AM

API/C memory mananegemnt problem
 
Hi everybody,
I have a problem with Python/C API and memory management.

I'm using
Python 2.3.5 (#1, Jan 4 2006, 16:44:27)
[GCC 4.0.2 20050901 (prerelease) (SUSE Linux)] on linux2

In my C-module I have a loop like this:
***********************************************

int size=10000000;

output=(double *) calloc(size, sizeof(double));

py_output=PyList_New(0);

for(i=0; i<size; i++){
tmp=PyFloat_FromDouble(output[i]);
PyList_Append(py_output, tmp);
}

free(outout);

return py_output;

***********************************************

It returns to python module a (very large) list.

Problem: when I delete the list in python module (with python del statement)
not all memory is relased.

It look like all 10000000 tmp PyFloat allocated in C code
remain stored in memory.

Somebody can help me?

Thanks.

marco


All times are GMT. The time now is 05:50 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.