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/2001-April/014470.html below:

[Python-Dev] Memory management question

[Python-Dev] Memory management question [Python-Dev] Memory management questionGuido van Rossum guido@digicool.com
Fri, 27 Apr 2001 10:42:50 -0500
> I have tracked it down to the following sample, which does also not
> work. In the debug version on windows, the PyObject_REALLOC
> fails with an assertion-error: _CrtIsValidHeapPointer(pUserData)
> 
>  op = PyObject_NEW(PyClassObject, &PyClass_Type);
>  op = PyObject_REALLOC(op, sizeof(PyClassObject) + 20);
> 
> Should the above work or am I doing something wrong?

Probably this doesn't work because of the GC header.  The 'op' pointer
does not point to the start of the allocated memory block.
PyObject_NEW and friends know about this, but PyObject_REALLOC
doesn't.  That's what the assertion is trying to tell you.

--Guido van Rossum (home page: http://www.python.org/~guido/)



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