oliver.hahm at inria.fr
Tue Aug 9 21:27:39 CEST 2016
On Tue, Aug 09, 2016 at 12:01:08PM -0700, Sam Kumar wrote:
> I noticed that there is a "oneway-malloc" module in RIOT OS. It appears to
> be a thin wrapper around sbrk that only supports allocating memory, not
> freeing it.
This is correct. It was originally introduced for MSP430 platforms.
> I am doing some development using RIOT OS, and dynamic memory allocation
> would be useful to me. Is there already a module that implements dynamic
> memory allocation suitable for general-purpose use in the kernel and in
> user programs?
Dynamic memory allocation is usually a bad idea for embedded systems (see for
Within kernel context it MUST be completely avoided.
If you really need dynamic memory allocation, you can either use the TLSF
package  or use a simple memory manager that uses a static memory pool like
memmgr . TLSF is O(1), but works only on 32 bit platforms.
> If such a module does not already exist, I am willing to contribute a
> lightweight implementation of malloc, realloc, calloc, and free to replace
> the oneway-malloc module.
This could be a good idea indeed. :) I once had the above cited memmgr as
package in one of my private branches, but I guess I haven't pushed it to
Github. However, creating this package didn't take longer than half an hour.
The worst thing about Perl jokes is that next morning you can't understand why
they seemed so funny.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 819 bytes
Desc: not available
More information about the devel