document free_sized API
parent
c3a580727a
commit
829ace403f
10
malloc.h
10
malloc.h
|
@ -85,6 +85,16 @@ size_t h_malloc_object_size(void *ptr);
|
||||||
// similar to malloc_object_size, but avoiding locking so the results are much more limited
|
// similar to malloc_object_size, but avoiding locking so the results are much more limited
|
||||||
size_t h_malloc_object_size_fast(void *ptr);
|
size_t h_malloc_object_size_fast(void *ptr);
|
||||||
|
|
||||||
|
// The free function with an extra parameter for passing the size requested at
|
||||||
|
// allocation time.
|
||||||
|
//
|
||||||
|
// This offers the same functionality as C++14 sized deallocation and can be
|
||||||
|
// used to implement it.
|
||||||
|
//
|
||||||
|
// A performance-oriented allocator would use this as a performance
|
||||||
|
// enhancement with undefined behavior on a mismatch. Instead, this hardened
|
||||||
|
// allocator implementation uses it to improve security by checking that the
|
||||||
|
// passed size matches the allocated size.
|
||||||
void h_free_sized(void *ptr, size_t expected_size);
|
void h_free_sized(void *ptr, size_t expected_size);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue