[Python-bugs-list] [ python-Bugs-606495 ] malloc called directly
noreply@sourceforge.net
noreply@sourceforge.net
Sun, 08 Sep 2002 17:00:44 -0700
Bugs item #606495, was opened at 2002-09-08 17:55
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=606495&group_id=5470
Category: None
Group: Python 2.2.1
Status: Open
Resolution: None
Priority: 5
Submitted By: Steven Ellmore (stevenellmore)
Assigned to: Nobody/Anonymous (nobody)
Summary: malloc called directly
Initial Comment:
At least the following files use malloc directly instead of
PyCore_MALLOC_FUNC (defined in pymem.h):
_sre.c
classobject.c
compile.c
There are many others too, but I'm working from a
stripped down codebase.
The Mac version is the worst offender.
----------------------------------------------------------------------
>Comment By: Steven Ellmore (stevenellmore)
Date: 2002-09-08 19:00
Message:
Logged In: YES
user_id=608086
It's a bug because it should be possible to embed Python in
an application that does its own memory management and
have Python play nice with it.
In this scenario, the ONLY thing that should be calling malloc
directly is the memory manager. Everything else should
route through the memory manager so that application
specific heap management can take place.
At the embedded system scale (think: no virtual memory),
the typical operation of a custom memory manager is to
malloc all of memory, which means that any subsequent
rogue calls to malloc will fail.
----------------------------------------------------------------------
Comment By: Tim Peters (tim_one)
Date: 2002-09-08 18:55
Message:
Logged In: YES
user_id=31435
Why do you think this is a bug? There's no rule against
calling malloc(), other than if you do, you must call free()
instead of one of the PyMem or PyObject free functions.
Note that PyCore_MALLOC_FUNC doesn't exist in the
current CVS source -- we purged a lot of unused complexity
in those macro layers for 2.3.
----------------------------------------------------------------------
Comment By: Steven Ellmore (stevenellmore)
Date: 2002-09-08 18:27
Message:
Logged In: YES
user_id=608086
Followup:
Oops...I think the correct solution is to have them use
PyMem_MALLOC and NOT PyCore_MALLOC_FUNC.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=606495&group_id=5470