#18868: a MemoryAllocator object for easier Cython memory management
---------------------------+---------------------------------
Reporter: ncohen | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: sage-6.8
Component: cython | Keywords:
Merged in: | Authors: Nathann Cohen
Reviewers: | Report Upstream: N/A
Work issues: | Branch:
Commit: | Dependencies:
Stopgaps: |
---------------------------+---------------------------------
This is a re-implementation of an example appearing in Cython's
documentation (see bottom of [1]).
The idea is simple: an object has a `.malloc` method, and returns arrays
of memory. When that object is garbage-collected, the memory it allocated
is automatically freed.
This makes it much easier to deal with C pointers in Cython code, which
must be freed before any 'return' and whenever an exception can be raised.
As an illustration of how useful this can be, I removed a *lot* of graph
code.
Nathann
[1] http://docs.cython.org/src/tutorial/memory_allocation.html
--
Ticket URL: <http://trac.sagemath.org/ticket/18868>
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-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.