Re: API/C memory mananegemnt problem

2006-03-11 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: > This exactly what I was thinking. > > Are we wrong Alex? Nope, you're not -- since ints aren't "immortal" (but rather limited to being reused as other ints), then, if at no _other_ place in your program do you ever need to be storing N ints at the same time, looping

Re: API/C memory mananegemnt problem

2006-03-11 Thread plahey
This exactly what I was thinking. Are we wrong Alex? -- http://mail.python.org/mailman/listinfo/python-list

Re: API/C memory mananegemnt problem

2006-03-11 Thread Aahz
In article <[EMAIL PROTECTED]>, Alex Martelli <[EMAIL PROTECTED]> wrote: ><[EMAIL PROTECTED]> wrote: >> >> I think I understand the original statement now. What you are really >> saying is that there is a pool of Python float objects (which can, at >> different times, wrap different values) which

Re: API/C memory mananegemnt problem

2006-03-11 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: > Sorry for responding to my own post. > > I think I understand the original statement now. What you are really > saying is that there is a pool of Python float objects (which can, at > different times, wrap different values) which can grow but never > decrease in size

Re: API/C memory mananegemnt problem

2006-03-10 Thread plahey
Sorry for responding to my own post. I think I understand the original statement now. What you are really saying is that there is a pool of Python float objects (which can, at different times, wrap different values) which can grow but never decrease in size. So the memory held by this pool is di

Re: API/C memory mananegemnt problem

2006-03-10 Thread plahey
I have not looked into C programming and Python so I probably don't understand the issues here but the above statement sounds very troubling. Does this mean that any integer or float created anywhere at anytime in a (pure) python program will be stored away for all time (as long as the program is

Re: API/C memory mananegemnt problem

2006-03-10 Thread Tim Peters
[EMAIL PROTECTED] > 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: > ***

API/C memory mananegemnt problem

2006-03-10 Thread Marco Fumana
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=1000; output=(double *) calloc(size, sizeof(double)); py_output=PyList_New(0); for(i=0;

Re: API/C memory mananegemnt problem

2006-03-10 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > In my C-module I have a loop like this: > *** > > int size=1000; > > output=(double *) calloc(size, sizeof(double)); > py_output=PyList_New(0); > for(i=0; i tmp=PyFloat_FromDouble(output[i]); > PyList_Append(py_output,

API/C memory mananegemnt problem

2006-03-10 Thread fumana
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=1000; output=