Ticket 4503

zack leung zakthertemsdev at gmail.com
Thu Sep 9 02:17:30 UTC 2021


>Thanks! I guess i'm really unsure about how the pointer relates to the
amount of memory that you can use. I assume the Malloc keeps track of the
sections being used in the heap. Does this function Allocate 2 blocks since
the pointer is set to

(uintptr_t) next_block + HEAP_ALLOC_BONUS - alloc_begin;

>(I know it's a bit naive to assume this given my first question)

think the method is _Heap_Size_of_alloc_area. It may need a wrapper added
to the protected heap wrapper for safety. I don't know if it has one. It
should be the equivalent functionality.
> How would i implement a wrapper and what safety measures need to be
implemented. So far it's checking if :  the block is not in the heap and if
it's been previously used. Is the usable memory in the heap calculated by:
the size of the block * # of blocks?

Thanks, Zack

---------- Forwarded message ---------
From: Joel Sherrill <joel at rtems.org>
Date: Wed, 8 Sept 2021 at 20:30
Subject: Re: Ticket 4503
To: Gedare Bloom <gedare at rtems.org>
Cc: zack leung <zakthertemsdev at gmail.com>, rtems-devel at rtems.org <
devel at rtems.org>




On Wed, Sep 8, 2021 at 11:02 AM Gedare Bloom <gedare at rtems.org> wrote:

> Hi Zack,
>
> https://devel.rtems.org/ticket/4503
>
> The malloc implementation exists in the score as the Heap Manager. search
> for "Heap_" within cpukit to get some ideas where to look.
>

I think the method is _Heap_Size_of_alloc_area. It may need a wrapper added
to the protected heap wrapper for safety. I don't know if it has one. It
should be the equivalent functionality.

newlib's malloc.h will need looking at to make sure we provide the right
methods.



>
> @Joel are these two tickets duplicates?
> https://devel.rtems.org/ticket/4503
> https://devel.rtems.org/ticket/4271
>

Yes. Closed #4271 and merged comments.

--joel


>
>
> -Gedare
>
> On Tue, Sep 7, 2021 at 7:14 PM zack leung <zakthertemsdev at gmail.com>
> wrote:
>
>> I was wondering about ticket 4503. I was wondering where The required
>> functionality should be in the underlying score/ capability used can be
>> found to write this function. Also how does this relate  to
>>
>> Add common malloc family extension method malloc_usable_size()
>> <https://devel.rtems.org/ticket/4271>?
>> Thanks
>> Zack
>> _______________________________________________
>> devel mailing list
>> devel at rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20210909/01601cf5/attachment-0001.html>


More information about the devel mailing list