Kristján Valur Jónsson added the comment:
Hi.
the file and line arguments are for expanding from macros such as PyMem_MALLOC.
I had them added because they provide the features of a comprehensive
debugging API.
Of course, I'm not showing you the entire set of modifications that we have
made to the memory allocation scheme. They including more extensive versions
of the memory allocation tools, in order to more easily monitor memory
allocations from within C.
For your information, I'm uploading pymemory.h from our 2.7 patch. The extent
of our modifications can be gleaned from there.
Basically, we have layered the macros into outer and inner versions, in order
to better support internal diagnostics.
I'm happy with the api you provide, with a small addition:
PyAPI_FUNC(int) Py_SetAllocators(
char api,
void* (*malloc) (size_t size, void *data),
void* (*realloc) (void* ptr, size_t size, void *data),
void (*free) (void* ptr, void *data),
void *data
);
The 'data' pointer is pointless unless you can provide it as part of the api.
This sort of extra indirection is necessary for C callbacks to provide instance
specific context to statically compiled and linked callback functions.
----------
Added file: http://bugs.python.org/file30451/pymem.h
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue3329>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com