| the Compartmented Robust Posix C++ Unit Test system | hosted by |
|---|
Return the number of bytes allocated on the heap. This is the
sum of bytes requested in calls to malloc(),
calloc(), realloc(),
operator new() and
operator new[](). Heap management overhead is
not included.
![]() | Tip |
|---|---|
You can monitor for memory leaks by writing a fixture that
compares the return value from
crpcut::heap::allocated_bytes()
in the constructor and the destructor. |
Return the number of memory objects allocated on the heap by the
functions malloc(), calloc(),
realloc(), operator new() and
operator new[](). The allocation of an array of
elements is one object.
Set a limit on the available heap in absolute bytes, including all heap
space that is already used. The return value is the limit prior to
the call. Call set_limit(allocated_bytes()
+ , to set a limit
slightly above current use.
delta_bytes)
![]() | Note |
|---|---|
If you set the limit lower than the return value of
crpcut::heap::allocated_bytes()
the test will fail immediately.
|
![]() | Caution |
|---|---|
Calling set_limit() outside of a test, for
example in the constructor of a global object, will almost certainly
cause crpcut to malfunction.
|