[Python-Dev] RE: Program very slow to finish
M.-A. Lemburg
mal@lemburg.com
2001年11月07日 09:21:42 +0100
Neil Schemenauer wrote:
>> M.-A. Lemburg wrote:
> > What is considered the "right" approach for this ? Should Python
> > objects *always* be deallocated using one of PyObject_Del() and
> > PyObject_DEL() or is PyMem_DEL() usable as well ?
>> PyMem_DEL should not be used since it could be using a different
> allocator then PyObject_New.
>> > The reason I'm asking is that the mxDateTime objects I'm
> > deallocating are actually unreferenced objects on a
> > free list, so PyObject_Del() will probably bomb on them.
>> Why would it bomb? It doesn't do anything special as far as I can tell
> except free memory. Vladimir went a bit overboard with the
> pre-processor, IMHO, so its a little hard to tell for certain.
>> > Also, what should be done with failing constructors ? I usually
> > use PyMem_DEL() to prevent the deallocator from being called but
> > still free the allocated memory. Is that the correct approach ?
>> PyObject_Del() doesn't call the deallocator function.
Thanks for the clarifications. I'll turn to using PyObject_Del()
in all mx Extensions then.
--
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Consulting & Company: http://www.egenix.com/
Python Software: http://www.lemburg.com/python/