A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2010-June/100480.html below:

[Python-Dev] tp_dealloc

[Python-Dev] tp_dealloc [Python-Dev] tp_deallocGreg Ewing greg.ewing at canterbury.ac.nz
Tue Jun 1 02:33:23 CEST 2010
smarv at gmx.net wrote:
> Now, the problem is, Python appears to read-access the deallocated memory 
> still after tp_dealloc.

It's not clear exactly what you mean by "after tp_dealloc".
The usual pattern is for a type's tp_dealloc method to call
the base type's tp_dealloc, which can make further references
to the object's memory. At the end of the tp_dealloc chain,
tp_free gets called, which is what actually deallocates the
memory.

I would say your tp_dealloc shouldn't be modifying anything
in the object struct that your corresponding tp_alloc method
didn't set up, because code further along the tp_dealloc
chain may rely on it. That includes fields in the object
header.

-- 
Greg
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4