A stress test to detect memory leaks under heavy allocation/deallocation cycles.
More...
A stress test to detect memory leaks under heavy allocation/deallocation cycles.
This test is not designed to check functional correctness, but rather to ensure the library's memory management is sound. It runs a tight loop that performs a large number of create/destroy cycles for complex forward and reverse trampolines.
In each iteration, it:
- Creates a new arena.
- Programmatically builds a complex
infix_type representing a nested struct with arrays.
- Creates a forward trampoline using this type.
- Destroys the forward trampoline.
- Creates a reverse trampoline using the same type.
- Destroys the reverse trampoline.
- Destroys the arena.
The test itself only asserts that it completes. Its true purpose is to be run under a memory analysis tool like Valgrind or AddressSanitizer (ASan). A "pass" for this test is a clean report from the memory tool, indicating that no memory was leaked across the thousands of iterations. This is crucial for ensuring the long-term stability of applications that frequently create and destroy trampolines.