docs/Writerside/topics/array_list.h.md

changeset 1425
83284b289430
parent 1424
563033aa998c
--- a/docs/Writerside/topics/array_list.h.md	Sun Oct 12 20:21:56 2025 +0200
+++ b/docs/Writerside/topics/array_list.h.md	Wed Oct 15 22:45:21 2025 +0200
@@ -96,15 +96,13 @@
     void *(*realloc)(void *array,
             size_t old_capacity, size_t new_capacity,
             size_t elem_size, CxArrayReallocator *alloc);
-    void *ptr1;
-    void *ptr2;
-    size_t int1;
-    size_t int2;
+    const CxAllocator *allocator;
+    const void *stack_ptr;
 } CxArrayReallocator;
 
 CxArrayReallocator cx_array_reallocator(
         const struct cx_allocator_s *allocator,
-        const void *stackmem
+        const void *stack_ptr
 );
 
 extern CxArrayReallocator* cx_array_default_reallocator;
@@ -120,12 +118,13 @@
 A reallocator created with the `cx_array_reallocator()` function uses a more sophisticated approach.
 On the one hand, it can use an arbitrary UCX [allocator](allocator.h.md) for the reallocation,
 and on the other hand, it can optionally keep track of a stack memory pointer.
-If you pass a non-`NULL` pointer to `stackmem`, the reallocator will _always_ allocate _new_ memory for the array,
-if the current location equals the `stackmem` address.
+If you pass a non-`NULL` pointer to `stack_ptr`, the reallocator will _always_ allocate _new_ memory for the array,
+if the current location equals the `stack_ptr` address.
 
 This allows you to allocate an array on the stack and instruct UCX to automatically move it to heap memory when the capacity is exceeded.
-Combined with a UCX [memory pool](mempool.h.md) this can be a powerful tool for local arrays
-which are expected to stay within the bounds of the stack memory most of the time, but are also allowed to sometimes grow their capacity.
+Combined with a UCX [memory pool](mempool.h.md) this can be a powerful tool.
+For example, you can add small arrays to your structs plus a memory pool and then use that memory pool to reallocate the arrays on the heap when needed.
+When you are done with the arrays, you can then use the memory pool to free the memory for those arrays that needed to be moved to the heap.
 
 ## Reserve
 
@@ -312,7 +311,7 @@
 and the latter function returns the closest element that is larger or equal (the least upper bound / supremum)
 than the searched element.
 
-> Note that all of the above functions are only well-defined on arrays which are sorted with respect to the given compare function.
+> Note that all the above functions are only well-defined on arrays which are sorted with respect to the given compare function.
 > 
 > This can, for example, easily be achieved by calling the standard library's `qsort()` function.
 >{style="note"}

mercurial