[Cython] [sage-devel] Re: Locally scoped dynamic memory (in SAGE and elsewhere)
Michael.Abshoff
michael.abshoff at googlemail.com
Thu Apr 10 19:33:55 CEST 2008
William Stein wrote:
> On Thu, Apr 10, 2008 at 10:02 AM, Michael.Abshoff
> <michael.abshoff at googlemail.com> wrote:
>> > But, test test suite doesn't test for all of the odd input that users
>> > will feed to sage. These are the cases that will leak memory and
>> > there is not possible way to test for all of them. Also debugging
>> > memory leaks is super nasty. Compared to that pain, having a slightly
>> > slower memory allocator is not a big deal.
>>
>> Well, as long as you write code in C memory leaks when something goes
>> wrong is something you have to live with. And python is far from perfect
>> regarding memory management too IMHO as I point out above. Another issue
>> is that once we have extensions that do work with threads we no longer
>> can use Python's allocation since it isn't thread safe.
>>
>> Adding some more checks to the Sage codebase around allocations is
>> something that ought to be done, but on the list of things to fix
>> potential memory leaks from garbage input is low on the list of my
>> personal priority as long as we have real leaks to deal with. Feel free
>> to try out the above and report back if it fixes issues and how much of
>> an impact on performance it has.
>>
>
> 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 code for "the solution" and noticed that we haven't.
Yes, without a doubt, but I am skeptical that that solution would work
[Brian never claimed it did and actually raised that concern].
> That said, this is definitely not the most important thing for *us*
> to worry about at this point. We have many more important
> problems to solve first. But I'm really glad Brian is raising this
> issue, etc.
>
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.
And having been burned over and over again has left me the way I am ;)
> -- William
Cheers,
Michael
> _______________________________________________
> Cython-dev mailing list
> Cython-dev at codespeak.net
> http://codespeak.net/mailman/listinfo/cython-dev
>
More information about the Cython-dev
mailing list