Function lbcrypto::AllocTrim

Function Documentation

bool lbcrypto::AllocTrim()

AllocTrim() returns free (unused) heap memory to the operating system. It is the companion to OpenFHE’s retain-by-default malloc tuning: call it at a quiescent point after a large transient-footprint operation (e.g., EvalBootstrap) to reclaim peak scratch memory.

This is a performance/RSS utility, NOT a security primitive: it does not erase data. Use secure_memset() to wipe sensitive memory before freeing. It is not async-signal-safe.

Returns

true if a trim was attempted, false on unsupported platforms.