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, 3 Dec 2018 15:56 Nils Bruin <nbr...@sfu.ca wrote:

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 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 never called. What is going on? What is the
correct design here?

Dima


---------- Forwarded message ---------
From: sage-trac <tr...@sagemath.org>
Date: Mon, 3 Dec 2018 15:02
Subject: Re: [sage-trac] #26795: Some memory leaks
To:


#26795: Some memory leaks

-------------------------------------+-------------------------------------
        Reporter:  jmantysalo         |        Owner:
            Type:  defect             |       Status:  needs_work
        Priority:  major              |    Milestone:  sage-8.5
       Component:  memleak            |   Resolution:
        Keywords:                     |    Merged in:
         Authors:  Dima Pasechnik     |    Reviewers:
Report Upstream:  N/A                |  Work issues:
          Branch:                     |       Commit:
   public/packages/glpkbackendmemleak |
c42c3bc27da534544dc62a953d5457d6c27532b5
    Dependencies:                     |     Stopgaps:

-------------------------------------+-------------------------------------

Comment (by dimpase):

  Replying to [comment:21 jmantysalo]:
  > What's this:
  >
  > {{{
  > import gc
  >
  > i = 0
  > GG = graphs()
  > _ = next(GG); _ = next(GG);
  > for P in GG:
  >     if i > 20000: break
  >     if i % 1000 == 0:
  >         _ = gc.collect()
  >         print get_memory_usage(), P.order()
  >     i += 1
  >     _ = P.convexity_properties()
  > }}}
  >
  > ??? There is an explicit `__destruct__` in class `ConvexityProperties`.

  however, `__destruct__` is not called, as one can see by putting a
  `print()` there.

--
Ticket URL: <https://trac.sagemath.org/ticket/26795#comment:26>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple,
Mathematica, and MATLAB

--
You received this message because you are subscribed to the Google Groups
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.



--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to