[U-Boot] [PATCH] malloc_simple: Add simple malloc free function

Marek Vasut marex at denx.de
Thu Aug 4 07:30:18 CEST 2016


On 08/03/2016 05:22 PM, Chin Liang See wrote:

Hi,

[...]
>>> It's the fat driver which is utilizing the malloc.
>>
>> So fat is allocating stuff without freeing it ? I wonder if we should
>> either fix fat or use full malloc in SPL on A10 . I am not really
>> fond
>> of adding more stuff into simple malloc (to keep it small and 
>> simple).
> 
> Actually fat driver is good where it invoke malloc and free during the
> operation. Just that with existing malloc, there is no free
> implementation and memory keep "push" every time malloc invoked.

And I agree with Simon that we should look into the FAT driver and fix
it. Is that not possible ?

>>>> Your design breaks in the scenario where someone does big malloc
>>>> followed by two small mallocs if I understand it correctly. This
>>>> doesn't scale and is a hack.
>>>>
>>>
>>> Actually the proposed free is a simple implementation which acts as
>>> stack push and pop with depth of 2. This is to enhance existing
>>> implementation which don't handle the pop. This get worst
>>> especially
>>> dealing with fat driver.
>>
>> Well, how does it handle my example? It doesn't and it fails to help
>> in
>> such case, right ?
> 
> I was thinking what is the correct depth while trying to keep things
> simple. From the FAT access testing with SD and eMMC, depth of 2 works
> well by cutting lot of memory consumption by simple malloc
> implementation. Any thoughts whether should have more flexibility?

You still didn't answer my question -- how will this handle my example
usecase ?

-- 
Best regards,
Marek Vasut


More information about the U-Boot mailing list