Crate snmalloc_sys
source ·Functions§
- Allocate
countitems ofsizelength each. Returnsnullifcount * sizeoverflows or on out-of-memory. All items are initialized to zero. - Free previously allocated memory. The pointer
pmust have been allocated before (or be null). - Allocate
sizebytes. Returns pointer to the allocated memory or null if out of memory. Returns a unique pointer if called withsize0. - Return the available bytes in a memory block.
- Re-allocate memory to
newsizebytes. Return pointer to the allocated memory or null if out of memory. If null is returned, the pointerpis not freed. Otherwise the original pointer is either freed or returned as the reallocated result (in case it fits in-place with the new size). Ifpis null, it behaves assn_malloc. Ifnewsizeis larger than the originalsizeallocated forp, the bytes aftersizeare uninitialized. - Allocate the memory with the given alignment and size. On success, it returns a pointer pointing to the required memory address. On failure, it returns a null pointer. The client must assure the following things:
- Behaves like rust_alloc, but also ensures that the contents are set to zero before being returned.
- De-allocate the memory at the given address with the given alignment and size. The client must assure the following things:
- Re-allocate the memory at the given address with the given alignment and size. On success, it returns a pointer pointing to the required memory address. The memory content within the
new_sizewill remains the same as previous. On failure, it returns a null pointer. In this situation, the previous memory is not returned to the allocator. The client must assure the following things: