get_heap_info memsets stats element

Joel Sherrill joel at
Wed Apr 13 14:57:57 UTC 2022

On Wed, Apr 13, 2022 at 8:32 AM Matthew J Fletcher <amimjf at> wrote:

> Hi,
> _Heap_Get_information provides the information but its then memset after
> retrieval, is this a bug or design ?
>   _Heap_Get_information(heap, info);
>   memset(&info->Stats, 0, sizeof(info->Stats));

In this case, this call is in support of resource snapshot. This is used in
to ensure the number of objects/allocations is the same before and after a
test case is executed. It verifies no leaks.

The stats section has the number of calls, maximum memory allocated, etc.
would legitimately change. By zero'ing it out, it makes it possible to
the before and after versions.

Would be good to have a comment here explaining that. Patch welcome. :_


> --
> regards
> ---
> Matthew J Fletcher
> _______________________________________________
> users mailing list
> users at

More information about the users mailing list