Skip to content

Commit 06b236f

Browse files
authored
Merge pull request #124 from JacobBarthelmeh/staticmemory
add some global heap hint documentation
2 parents 4f72427 + d29e2e1 commit 06b236f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

wolfSSL/src/chapter04.md

+14
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,20 @@ unsigned char IO_MEM[IO_MEM_SIZE]; 
646646

647647
After this, when you are done using the WOLFSSL_CTX structure, free it with the usual wolfSSL_CTX_free().
648648

649+
#### Setting a Global Heap Hint
650+
651+
A global heap hint can be set using the API `void* wolfSSL_SetGlobalHeapHint(void* heap)`.
652+
When a global heap hint is set all calls to XMALLOC and XFREE using a NULL pointer as the
653+
heap hint will be redirected to use the global heap hint set. This is useful in cases where
654+
no system malloc is available to fall back to and NULL heap hint pointers are being used.
655+
The function wolfSSL_SetGlobalHeapHint returns the current global heap hint set, and is NOT
656+
considered to be thread safe.
657+
658+
The getter function `void* wolfSSL_GetGlobalHeapHint(void)` can be used to get the current
659+
global heap hint set.
660+
661+
This functionality was added in versions of wolfSSL after version 5.7.0.
662+
649663
### Adjustment of Static Buffer Allocation
650664

651665
The static-buffer-allocation option provided by wolfSSL manages the specified buffer by dividing it into multiple areas called "buckets" as shown in the following diagram. Multiple memory blocks of the same size are linked within a bucket. The figure below omits the structure that manages the memory block, but a buffer with a size that includes the omitted structure is required.

0 commit comments

Comments
 (0)