Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > API/C memory mananegemnt problem

Thread Tools

API/C memory mananegemnt problem

Marco Fumana
Posts: n/a
Thank for your help.

I have try to follow your suggestion but I seem to fail.

Now my C-module (call it C_Core) code is:

/* create_list function */
int size=10000000;

output=(double *) calloc(size, sizeof(double));
for(i=0; i<size; i++){
PyList_Append(py_output, tmp);
Py_DECREF(tmp); // append adds a reference



return py_output;

with del statement all memory is relased, but I have a malformed list.

In python shell:
# Call C function an create a list

# check the list
# OK
Segmentation fault

On the other size your last option with
PyList_SET_ITEM(py_output, tmp) statement
is quick, but I have still memory problem.

Any idea?

Thank a lot
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: API/C memory mananegemnt problem Tim Peters Python 6 03-12-2006 01:58 AM
API/C memory mananegemnt problem Python 0 03-10-2006 08:19 AM
Patriot Memory PDC1G5600ELK Memory Review Silverstrand Front Page News 0 09-07-2005 02:24 AM
Differences between Sony Memory Stick & memory Stick Pro vs Memory Stick Duo? zxcvar Digital Photography 3 11-28-2004 10:48 PM
GC does not release memory...memory keeps growing!!! Mahesh Prasad ASP .Net 1 02-22-2004 08:40 AM