ARMmbed / core-util

DEPRECATED: Mbed 3 utilities library
Other
12 stars 17 forks source link

Extendable pool allocator #3

Closed bogdanm closed 9 years ago

bogdanm commented 9 years ago

The extendable pool allocator behaves like a pool allocator (can only allocate elements of a certain size), but can extend itself automatically when it runs out of memory by calling 'mbed_ualloc' to get space for another pool. The implementation is designed to be reentrant and to minimize the time spent in critical sections.

bogdanm commented 9 years ago

@autopulated , @0xc0170 , I know you hate me by now, but I can't help it :) I plan to allocate stuff from MINAR on top of this extendable thing, but other than that it is absolutely general purpose. Also, does anybody have any good pointers about how to test if some piece of code is truly reentrant?

bogdanm commented 9 years ago

OK, I've changed the memory layout and hopefully made the code easier to read. I'm still waiting for comments on the race condition, I'm curious if you're thinking of a fairly pathological case or something simpler that I didn't take into account.

bogdanm commented 9 years ago

@autopulated , does the latest commit look like it'd made race conditions less likely ?

autopulated commented 9 years ago

Yeah that looks better

bogdanm commented 9 years ago

OK, I'm going to wait a bit more for comments, then merge this.