You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Allocate a contiguous block of memory from the custom heap.
159
191
*
160
-
* Allocates a block of at least `bytes` bytes from the allocator's managed
161
-
* heap and returns a pointer to the start of the usable memory region.
162
-
* @param bytes Number of bytes requested.
163
-
* @return Pointer to the allocated memory region, or NULL if the heap is
164
-
* uninitialized or no suitable block is available.
192
+
* Requests a block of at least `bytes` bytes from the allocator and returns
193
+
* a pointer to the start of the usable data region.
194
+
* @param bytes Number of bytes requested; value is rounded up to the allocator's alignment (ALIGN). A request of 0 returns NULL.
195
+
* @return Pointer to the start of the allocated usable memory, or NULL if the heap is uninitialized, `bytes` is zero, or no suitable block is available.
* Resize an allocated memory block to a new size, preserving existing data up
255
-
* to the smaller of the old and new sizes.
256
-
* @param ptr Pointer to a previously allocated memory block (must be non-NULL
257
-
* and returned by this allocator).
258
-
* @param new_size New size in bytes for the allocation.
259
-
* @returns Pointer to the newly allocated memory containing the copied data,
260
-
* or `NULL` if allocation failed.
261
-
*/
285
+
* Resize an allocated memory block to hold at least `new_size` bytes, preserving existing data up to the smaller of the old and new sizes.
286
+
*
287
+
* If `ptr` is `NULL`, the call is equivalent to `malloc(new_size)`. If `new_size` is 0, the allocation is freed and `NULL` is returned. The requested size is rounded up to the allocator's alignment before allocation.
288
+
* @param ptr Pointer to a previously allocated memory block returned by this allocator, or `NULL`.
289
+
* @param new_size Desired size in bytes for the allocation.
290
+
* @returns Pointer to a memory region containing the original data (possibly relocated), or `NULL` if allocation failed or `new_size` was 0.
0 commit comments