[sage-devel] Memory leaks

2018-12-03 Thread Samuel Lelievre
Following the recent surge of interest in memory leaks, can people with the relevant expertise revisit the open tickets on that theme: check whether the leaks they report can still be observed, narrow down their cause, fix them if possible? Here is a Trac query revealing a number of such tickets.

[sage-devel] Re: Fwd: [sage-trac] #26795: Some memory leaks

2018-12-03 Thread Simon King
Hi! On 2018-12-03, Jori =?ISO-8859-1?Q?M=E4ntysalo?= wrote: > I grepped the source, and this was the only __destruct__(). Of course > there might be other misnamed methods. By > > egrep -R 'def __d[^ (]+' src/sage -o --no-filename | colrm 1 4 | sort | uniq > -c | sort -rn > > I found only __del

Re: [sage-devel] Fwd: [sage-trac] #26795: Some memory leaks

2018-12-03 Thread Jori Mäntysalo
On Mon, 3 Dec 2018, Dima Pasechnik wrote: An expert in Cython/Python classes needed: __destruct__ is not called for a reason I don't understand. [ Resolution: Should have been __dealloc__ ] I grepped the source, and this was the only __destruct__(). Of course there might be other misnamed me

Re: [sage-devel] Re: [sage-trac] #26795: Some memory leaks

2018-12-03 Thread Dima Pasechnik
Thanks everyone, __dealloc__ works marvellously. That poor __desrtuct__() was never called (except by a sort of meaningless doctesting), since it got there in 2011... Actually, I wonder if there is a regular way to doctest destructors like this one. On Mon, Dec 3, 2018 at 4:19 PM Vincent Delecroi

[sage-devel] Re: Weak references in the coercion model

2018-12-03 Thread Nils Bruin
On Monday, December 3, 2018 at 2:46:50 AM UTC-8, Jeroen Demeyer wrote: > > It's not clear to me why this double weak reference is needed, but maybe > I'm missing something. It seems more logical to use strong references in > the coercion map but then store a weak reference to the map. > > The we

Re: [sage-devel] Re: [sage-trac] #26795: Some memory leaks

2018-12-03 Thread Vincent Delecroix
Old or new, C-allocator is __cinit__ and C-deallocator is __dealloc__. The __destruct__ method is not special in any way (beyond the fact that it starts and ends by two underscores). Le 03/12/2018 à 17:07, Dima Pasechnik a écrit : It is old code. And there is no __cinit__, only __init__ On Mon

[sage-devel] Journal of Open Source Software

2018-12-03 Thread Daniel S. Katz
Hi, I was looking for a reviewer for a math software submission to the Journal of Open Source Software (JOSS), and one of the potential reviewers I contacted suggested I write to this group about the journal in an effort to find more potential reviewers for such software. I did find a reviewer

Re: [sage-devel] Re: [sage-trac] #26795: Some memory leaks

2018-12-03 Thread Dima Pasechnik
It is old code. And there is no __cinit__, only __init__ On Mon, 3 Dec 2018 15:56 Nils Bruin Is there something new in cython that makes __destruct__ a special method? > I thought __dealloc__ was the place to undo __cinit__ stuff. > > On Monday, December 3, 2018 at 7:29:14 AM UTC-8, Dima Pasechn

[sage-devel] Re: [sage-trac] #26795: Some memory leaks

2018-12-03 Thread Nils Bruin
Is there something new in cython that makes __destruct__ a special method? I thought __dealloc__ was the place to undo __cinit__ stuff. On Monday, December 3, 2018 at 7:29:14 AM UTC-8, Dima Pasechnik wrote: > > An expert in Cython/Python classes needed: __destruct__ is not called for > a reason

[sage-devel] Fwd: [sage-trac] #26795: Some memory leaks

2018-12-03 Thread Dima Pasechnik
An expert in Cython/Python classes needed: __destruct__ is not called for a reason I don't understand. There is class Graph with a method convexity_properties which calls cdef'd class ConvexityProperties in a separate pyx file. A destructor for the latter is defined as def __destruct__ but is nev

[sage-devel] Re: Weak references in the coercion model

2018-12-03 Thread Jean-Pierre Flori
You should surely be able to extract some info in this ticket where we fought hard memory leaks: https://trac.sagemath.org/ticket/715 Maybe comment 75 though I did not really go through the whole ticket: https://trac.sagemath.org/ticket/715#comment:75 -- You received this message because you are

[sage-devel] Weak references in the coercion model

2018-12-03 Thread Jeroen Demeyer
I am studying the coercion model in detail, looking for optimization opportunities. One source of slow-down is the use of weak references. Over time, more and more places in Sage use weak references. But I'd like to look at the big picture and see where weak references should be used and where

Re: [sage-devel] Re: Memory leak in poset dimension()

2018-12-03 Thread Dima Pasechnik
let's move this to #26795: see https://trac.sagemath.org/ticket/26795#comment:19 On Mon, Dec 3, 2018 at 9:34 AM Jori Mäntysalo wrote: > > On Mon, 3 Dec 2018, Dima Pasechnik wrote: > > > please post the test you use. > > import gc > > i = 0 > for P in Posets(8): > if i % 1000 == 0: >

Re: [sage-devel] Re: Memory leak in poset dimension()

2018-12-03 Thread Jori Mäntysalo
On Mon, 3 Dec 2018, Dima Pasechnik wrote: please post the test you use. import gc i = 0 for P in Posets(8): if i % 1000 == 0: gc.collect() print get_memory_usage() i += 1 _ = P.dimension() -- Jori Mäntysalo

Re: [sage-devel] Re: Memory leak in poset dimension()

2018-12-03 Thread Dima Pasechnik
please post the test you use. I don't see anything interesting there... On Mon, Dec 3, 2018 at 7:39 AM Jori Mäntysalo wrote: > > On Sun, 2 Dec 2018, Dima Pasechnik wrote: > > > do you still see it with https://trac.sagemath.org/ticket/26795 ? > > Yes, it is still there. > > -- > Jori Mäntysalo -