get_heap_info memsets stats element

Matthew J Fletcher amimjf at gmail.com
Fri Apr 15 11:01:42 UTC 2022


Hi Joel

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

I think i probably owe you a patch, given i've been using RTEMS (on-off)
now for 20 years, at least back to
https://lists.rtems.org/pipermail/users/2001-November/037648.html

m68k targets, RedHat 5 build machines with 64mb ram, those were the days !

regards, Matthew.


On Wed, 13 Apr 2022 at 15:58, Joel Sherrill <joel at rtems.org> wrote:

>
>
> 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
>>
>

-- 

regards
---
Matthew J Fletcher


More information about the users mailing list