Skip to content

Commit 8a11389

Browse files
fix optimizer and update tester
1 parent 6a59396 commit 8a11389

3 files changed

Lines changed: 395 additions & 306 deletions

File tree

staticmemory/memory-bucket-optimizer/README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,14 @@
44
The staticmemory feature ends up using a bit more memory and is a simple sectioning up of a static buffer used dynamically instead of malloc/free. wolfSSL has the option for users to define custom XMALLOC/XFREE if wanting to use a different allocater.
55

66

7-
This tool analyzes memory allocation patterns in wolfSSL and recommends optimal static memory bucket configurations to minimize wasted memory.
8-
9-
## Overview
10-
11-
When wolfSSL is built with the `--enable-staticmemory` option, it uses a static memory management system with memory buckets. The size and distribution of these buckets can significantly impact memory usage efficiency. This tool helps optimize these bucket configurations for specific TLS operations.
7+
The exact optimized configuration is a difficult problem (think traveling salesman problem), but this optimizer gives a good starting point. It uses a simple algorithm in that it fill the first half of bucket sizes with largest allocations and the second half based on max concurrent uses.
128

139
## Directory Structure
1410

1511
```
1612
memory-bucket-optimizer/
1713
├── optimizer/ # Source code for the optimizer
14+
├── tester/ # Source code for testing configuration
1815
└── README.md # This file
1916
```
2017

@@ -59,3 +56,13 @@ make
5956
./memory_bucket_optimizer testwolfcrypt.log
6057
```
6158

59+
4. Build and run tester (optional)
60+
61+
```
62+
cd ~/wolfssl
63+
./configure CPPFLAGS="-DWOLFSSL_NO_MALLOC -DWOLFSSL_DEBUG_MEMORY -DWOLFSSL_DEBUG_MEMORY_PRINT" --enable-staticmemory
64+
make && sudo make install
65+
cd tester && make
66+
./memory_bucket_tester ../testwolfcrypt.log --buckets "289,832,1056,1072,1152,1616,1632,3160,4240" --dist "2,1,2,1,1,1,1,19,1" --buffer-size 74298
67+
```
68+

0 commit comments

Comments
 (0)