Author kristjan.jonsson
Recipients Rhamphoryncus, amaury.forgeotdarc, barry, gregory.p.smith, jlaurila, jszakmeister, kristjan.jonsson, ncoghlan, neilo, pitrou, pjmcnerney, rhettinger, tlesher, vstinner
Date 2013-06-03.09:37:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1370252269.58.0.0834052798738.issue3329@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2013-06-03 09:37:49kristjan.jonssonsetrecipients: + kristjan.jonsson, barry, rhettinger, gregory.p.smith, amaury.forgeotdarc, ncoghlan, Rhamphoryncus, pitrou, vstinner, jszakmeister, tlesher, jlaurila, neilo, pjmcnerney
2013-06-03 09:37:49kristjan.jonssonsetmessageid: <1370252269.58.0.0834052798738.issue3329@psf.upfronthosting.co.za>
2013-06-03 09:37:49kristjan.jonssonlinkissue3329 messages
2013-06-03 09:37:49kristjan.jonssoncreate