lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 8/2/2017 7:23 PM, RAHUL KUMAR wrote:
Right but problem is that system free is not available /restricted
and even if it is then it will lead to fragmentation. So i was
thinking to manage the memory myself after system malloc. Just
wanted to check if there is already allocator available ?

If you have enough memory/performance, Doug Lea's malloc seems pretty popular, it's like a de facto standard. Even Cygwin uses it, only grumblings I recall relating to Cygwin's malloc are some talk of wishing to maximize performance with some sort of multi-threaded malloc.

uClibc has some malloc implementations. There are a number of other small libc projects in the style of uClibc, all of which should offer some sort of malloc.

On Wed, Aug 2, 2017 at 4:47 PM, Dhaval Kapil wrote:

    > Let me confess i am newbee on Lua and embedded. I am trying to
    port Lua on custom freertos running on CM4 and which does not
    have reallocation. is there any standard custom memory
    allocator available?

    I understand that 'realloc' is unavailable on the custom freertos.

    If you want a 'hack' to get it running, you could probably
    implement the 'realloc' function as a wrapper over 'malloc'
    and 'free'?

    On Wed, Aug 2, 2017 at 4:39 PM, RAHUL KUMAR
    <ryadav.exe@gmail.com <mailto:ryadav.exe@gmail.com>> wrote:

        Let me confess i am newbee on Lua and embedded. I am
        trying to port Lua on custom freertos running on CM4 and
        which does not have reallocation. is there any standard
        custom memory allocator available?

        I was thinking to request a bigger chunk of memory in one
        shot from the system and later custom allocator will keep
        allocating and free memory chunk from that.

        Looking forward to hear from you guys.

        -Rahul


--
Cheers,
Kein-Hong Man (esq.)
Selangor, Malaysia