Re: Hooking into Python's memory management

2011-05-04 Thread Daniel Neilson
Thanks for the feedback, everyone. I spent some time today playing around with the gc module, and came to the same conclusion that many of you have as well. for o in gc.get_objects(): print(o) was sufficient to convince me that I didn't want to go that route. Writing a simple mem

Re: Hooking into Python's memory management

2011-05-04 Thread scattered
On May 4, 12:51 pm, Daniel Neilson wrote: > Hello, >   I'm hoping that there will be someone here with sufficient expertise > to answer a question on Python 3 for me. > >   I work in the Computer Science department at a large Canadian > University. We are currently doing a feasibility analysis for

Re: Hooking into Python's memory management

2011-05-04 Thread Gregory Ewing
Daniel Neilson wrote: 1) Maintain a list of object id()'s for objects that have been created. Ideally, this list would also contain the file & line number where the object was created. 2) Provide a "deallocate" function that will remove a given object's id() from the list from (1). 3) P

Re: Hooking into Python's memory management

2011-05-04 Thread Terry Reedy
On 5/4/2011 12:51 PM, Daniel Neilson wrote: Hello, I'm hoping that there will be someone here with sufficient expertise to answer a question on Python 3 for me. I work in the Computer Science department at a large Canadian University. We are currently doing a feasibility analysis for switching

Re: Hooking into Python's memory management

2011-05-04 Thread Dan Stromberg
Sturla had some great comments; I'll add, in no particular order: 1) You could use the ctypes module to call the real malloc and free from Python. 2) Yes, a Python "C extension module" can do explicit memory allocation. 3) Cython provides a language that is a hybrid of Python and C. It might be n

Re: Hooking into Python's memory management

2011-05-04 Thread sturlamolden
On May 4, 6:51 pm, Daniel Neilson wrote: >   In either case, if such a module is possible, any pointers you could > provide regarding how to implement such a module would be appreciated. The gc module will hook into the garbage collector. The del statement will remove an object from the curren

Hooking into Python's memory management

2011-05-04 Thread Daniel Neilson
Hello, I'm hoping that there will be someone here with sufficient expertise to answer a question on Python 3 for me. I work in the Computer Science department at a large Canadian University. We are currently doing a feasibility analysis for switching to using Python in our first year major