File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -134,6 +134,16 @@ NumPy C-API functions
134134 void (*free) (void *ctx, void *ptr, size_t size);
135135 } PyDataMemAllocator;
136136
137+ The use of a ``size `` parameter in ``free `` differentiates this struct from
138+ the :c:type: `PyMemAllocatorEx ` struct in Python. This call signature is
139+ used internally in NumPy currently, and also in other places for instance
140+ C++11 (maybe older): https://en.cppreference.com/w/cpp/memory/allocator/deallocate
141+ C++17: https://en.cppreference.com/w/cpp/memory/polymorphic_allocator/deallocate
142+ Rust (allocator_api): https://doc.rust-lang.org/std/alloc/trait.Allocator.html#tymethod.deallocate
143+
144+ The user must keep track of ``size `` and make sure it is consistent with
145+ the ``alloc `` parameter.
146+
137147.. c :function :: const PyDataMem_Handler * PyDataMem_SetHandler (PyDataMem_Handler *handler)
138148
139149 Sets a new allocation policy. If the input value is ``NULL ``, will reset
You can’t perform that action at this time.
0 commit comments