Skip to content

Commit

Permalink
Wording tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
maddeleine committed Nov 11, 2024
1 parent 77944dd commit c65aa00
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/usage-guide/topics/ch02-initialization.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Initialization and Teardown

## Initialization
The s2n-tls library must be initialized with `s2n_init()` before calling most library functions. `s2n_init()` will error if it is called more than once, even when an application uses multiple threads or processes.
The s2n-tls library must be initialized with `s2n_init()` before calling most library functions. `s2n_init()` will error if it is called more than once, even when an application uses multiple threads.

Initialization can be modified by calling `s2n_crypto_disable_init()` or `s2n_disable_atexit()` before `s2n_init()`.

Expand All @@ -11,7 +11,7 @@ If you are trying to use FIPS mode, you must enable FIPS in your libcrypto libra

## Teardown
### Thread-local Memory
We recommend calling `s2n_cleanup()` from every thread or process created after `s2n_init()` to ensure there are no memory leaks. s2n-tls has thread-local memory that it attempts to clean up automatically at thread-exit. However, this is done using pthread destructors and may not work if you are using a threads library other than pthreads.
We recommend calling `s2n_cleanup()` from every thread created after `s2n_init()` to ensure there are no memory leaks. s2n-tls has thread-local memory that it attempts to clean up automatically at thread-exit. However, this is done using pthread destructors and may not work if you are using a threads library other than pthreads.

### Library Cleanup
A full cleanup and de-initialization of the library can be done by calling `s2n_cleanup_final()`. s2n-tls allocates some memory at initialization that is intended to live for the duration of the process, but can be cleaned up earlier with `s2n_cleanup_final()`. Not calling this method may cause tools like ASAN or valgrind to detect memory leaks, as the memory will still be allocated when the process exits.

0 comments on commit c65aa00

Please sign in to comment.