Oh, it should be public, in my opinion. We do exactly that when we embed python into UnrealEngine. We keep pythons internal PyObject_Mem allocator, but have it ask UnrealEngine for its arenas. That way, we can still keep track of python's memory usage from with the larger application, even if the granularity of memory is now on an "arena" level, rather than individual allocs.
K > -----Original Message----- > From: Python-Dev [mailto:python-dev- > bounces+kristjan=ccpgames....@python.org] On Behalf Of Victor Stinner > Sent: 18. júní 2013 21:20 > To: Python Dev > Subject: Re: [Python-Dev] RFC: PEP 445: Add new APIs to customize Python > memory allocators > > typedef struct { > /* user context passed as the first argument > to the 2 functions */ > void *ctx; > > /* allocate a memory mapping */ > void* (*alloc) (void *ctx, size_t size); > > /* release a memory mapping */ > void (*free) (void *ctx, void *ptr, size_t size); > } PyMemMappingAllocator; > > The PyMemMappingAllocator structure is very specific to the pymalloc > allocator. There is no "resize", "lock" nor "protect" method. There is no way > to configure protection or flags of the mapping. The > PyMem_SetMappingAllocator() function was initially called > _PyObject_SetArenaAllocator(). I'm not sure that the structure and the > 2 related functions should be public. Can an extension module call private > (_Py*) functions or use a private structure? > > Or the structure might be renamed to indicate that it is specific to arenas? > > What do you think? > > Victor > _______________________________________________ > Python-Dev mailing list > Python-Dev@python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: http://mail.python.org/mailman/options/python- > dev/kristjan%40ccpgames.com _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com