[sage-devel] Re: [Cython] [sage-devel] Re: Locally scoped dynamic memory (in SAGE and elsewhere)

2008-04-10 Thread Robert Bradshaw
On Apr 10, 2008, at 11:10 AM, Michael.Abshoff wrote: > > Brian Granger wrote: > > Hi Brian, > >>> Sure and it is certainly good to be discussed. I didn't want to be >>> dismissive about the idea, it is just that I have been in the >>> "debugging >>> memory leaks in Cython extension" trenches

[sage-devel] Re: [Cython] [sage-devel] Re: Locally scoped dynamic memory (in SAGE and elsewhere)

2008-04-10 Thread Michael.Abshoff
Brian Granger wrote: Hi Brian, >> Sure and it is certainly good to be discussed. I didn't want to be >> dismissive about the idea, it is just that I have been in the "debugging >> memory leaks in Cython extension" trenches for the last eight months and >> hence I do not trust python or its m

[sage-devel] Re: Locally scoped dynamic memory (in SAGE and elsewhere)

2008-04-10 Thread Robert Bradshaw
On Apr 10, 2008, at 9:51 AM, Brian Granger wrote: > > Hi, > > (dual posted to sage and cython) > > A few of us (ipython and mpi4py devs) are wondering what the > best/safest way of allocating dynamic memory in a local scope > (method/function) is when using cython. An example would be if you > ne

[sage-devel] Re: [Cython] [sage-devel] Re: Locally scoped dynamic memory (in SAGE and elsewhere)

2008-04-10 Thread Brian Granger
> Sure and it is certainly good to be discussed. I didn't want to be > dismissive about the idea, it is just that I have been in the "debugging > memory leaks in Cython extension" trenches for the last eight months and > hence I do not trust python or its memory management at all any more. >

[sage-devel] Re: [Cython] [sage-devel] Re: Locally scoped dynamic memory (in SAGE and elsewhere)

2008-04-10 Thread Brian Granger
> Just for the record, I think Brian isn't suggesting we do anything > differently with Sage. He's writing lots of _new_ code using > Cython for his distributed matrix arrays project, and ran into this problem, > and thought -- surely the Sage folks have solved this. Then he looked > at our

[sage-devel] Re: Locally scoped dynamic memory (in SAGE and elsewhere)

2008-04-10 Thread Brian Granger
> It's I think a general problem not only in Python but in programming > in general. The authors of http://www.flintlib.org/ -- a pure C library -- > spent a lot of time worrying about this, just to I think decide that it's > a really hard problem. Very true. > That said, there is definite

[sage-devel] Re: Locally scoped dynamic memory (in SAGE and elsewhere)

2008-04-10 Thread William Stein
On Thu, Apr 10, 2008 at 10:04 AM, Brian Granger <[EMAIL PROTECTED]> wrote: > > > > Lisandro Dalcin (author of mpi4py) came up with the following trick > > > that, while more complicated, prevents memory leaks: > > > > > > cdef extern from "Python.h": > > > object PyString_FromStri

[sage-devel] Re: Locally scoped dynamic memory (in SAGE and elsewhere)

2008-04-10 Thread Brian Granger
> > Lisandro Dalcin (author of mpi4py) came up with the following trick > > that, while more complicated, prevents memory leaks: > > > > cdef extern from "Python.h": > > object PyString_FromStringAndSize(char*,Py_ssize_t) > > char* PyString_AS_STRING(object) > > > > cdef inline

[sage-devel] Re: Locally scoped dynamic memory (in SAGE and elsewhere)

2008-04-10 Thread William Stein
On Thu, Apr 10, 2008 at 9:51 AM, Brian Granger <[EMAIL PROTECTED]> wrote: > > Hi, > > (dual posted to sage and cython) > > A few of us (ipython and mpi4py devs) are wondering what the > best/safest way of allocating dynamic memory in a local scope > (method/function) is when using cython. An