Skip to content

Commit 79aefc7

Browse files
update description of wolfSSL_StaticBufferSz_ex function
1 parent 8641df7 commit 79aefc7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

wolfSSL/src/chapter04.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ When you're done using static memory allocation, you should call `void wc_Unload
807807
808808
#### Advanced Static Buffer Size Calculation
809809
810-
The function `int wolfSSL_StaticBufferSz_ex(unsigned int listSz, const word32 *sizeList, const word32 *distList, byte* buffer, word32 sz, int flag)` allows you to calculate the required buffer size for static memory allocation with custom bucket sizes and distributions. This is useful when you want to optimize memory usage for your specific application needs.
810+
The function `int wolfSSL_StaticBufferSz_ex(unsigned int listSz, const word32 *sizeList, const word32 *distList, byte* buffer, word32 sz, int flag)` is a pre-allocation planning tool that calculates how much of a given buffer can be effectively used for static memory allocation, based on the provided bucket sizes and distribution. It returns the usable portion of the buffer that fits complete buckets, excluding any unusable leftover space. This is useful for sizing and tuning static memory pools to maximize utilization and reduce overall memory usage.
811811
812812
Parameters:
813813
- `listSz`: Number of bucket sizes in the list
@@ -829,7 +829,7 @@ The static-buffer-allocation option provided by wolfSSL manages the specified bu
829829
830830
#### Macros for General Use Buffers
831831
832-
Each bucket varies in size depending on the number of memory blocks it contains and their size.
832+
Each bucket varies in size depending on the number of memory blocks it contains and their size.
833833
834834
The memory block size and number of blocks for each area to be used are defined in /wolfssl/wolfcrypt/memory.h with the following macros:
835835
@@ -839,7 +839,7 @@ The memory block size and number of blocks for each area to be used are defined
839839
#define WOLFSSL_STATIC_ALIGN 16 /* alignment 16 bytes by default*/
840840
#define WOLFMEM_MAX_BUCKETS 9 /* number of buckets */
841841
#define WOLFMEM_IO_SZ 16992 /* buffer size for I/O */
842-
#define LARGEST_MEM_BUCKET 16128 /* the max block size */
842+
#define LARGEST_MEM_BUCKET 16128 /* the max block size */
843843
#define WOLFMEM_BUCKETS 64,128,256,512,1024,2432,3456,
844844
4544,LARGEST_MEM_BUCKET
845845
#define WOLFMEM_DIST 49,10,6,14,5,6,9,1,1

0 commit comments

Comments
 (0)