get_heap_info memsets stats element

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


On Wed, Apr 13, 2022 at 8:32 AM Matthew J Fletcher <amimjf at gmail.com> 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
tests
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.
and
would legitimately change. By zero'ing it out, it makes it possible to
compare
the before and after versions.

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

--joel

>
> --
>
> regards
> ---
> Matthew J Fletcher
> _______________________________________________
> users mailing list
> users at rtems.org
> http://lists.rtems.org/mailman/listinfo/users
>


More information about the users mailing list