umm_malloc icon indicating copy to clipboard operation
umm_malloc copied to clipboard

Thanks for promoting umm_malloc

Open rhempel opened this issue 9 years ago • 6 comments

I am the original author of umm_malloc, and for fun I did a search on where it was being used and came upon your site. Thanks for the kind words and support of the library, I have not really touched it in years but it's good to know it's helping someone. I have now created a GitHub repo of my own for this project, and would like to pull your changes (and give you credit of course) if that's OK with you. Also, I plan on changing the test suite so that it uses a more standard testing framework - these things were not as popular years ago :-)

rhempel avatar Mar 03 '15 01:03 rhempel

Hello Ralph, nice to hear from you!

Yeah, since I found umm_malloc I use it in my every embedded project, it is really great. Thank you very much for your hard work on it.

That's great that you've created your own repo, so that allocator could be improved even more! And about testing - ironically enough, I'm myself learning testing framework (in particular, CppUTest) for my embedded designs these days. It looks promising, its author even wrote the book, in case you're interested: Test Driven Development for Embedded C

About pulling changes: of course I'm glad to hear that, please let me know if you're waiting for me to do something (I'm not sure how exactly changes could be pulled from my repo to yours, should I do something for that?)

dimonomid avatar Mar 03 '15 11:03 dimonomid

Hi both,

Firstly, neat allocator, was looking for an open source one aimed at embedded devices and this is just great.

Secondly.. there's a bug. In umm_realloc: on a malloc failure, it frees the original pointer. The standard assures this not to be the case, and Lua assumes this too (eg when reallocing hash tables, it assumes data isn't lost/corrupt should an expansion fail).

The fix is very straight forward - just move umm_free( oldptr) in umm_realloc to the same block as the memcpy.

The bug is present both here and on @rhempel's website.

HTH and thanks again for making it available here :)

almania avatar Mar 08 '15 08:03 almania

Technically, this should be a new issue :-) Side note, are you using this allocator in an embedded Kua implementation - that's what I wrote it for in the first place! If I get a chance, I'll fix on my site...

rhempel avatar Mar 08 '15 21:03 rhempel

I figured it should be after I posted, I was just too eager when I saw you both in one place ;). My first time using github.

And I am, I saw that on your site too - one of the things that drew me to it. Lua 5.2, which includes an emergency garbage collector in case of OOM which allows the allocator to run closer to the limit (I believe most embedded are Lua 5.1.X?), probably why it hasn't popped up before. Working great now though :)

almania avatar Mar 09 '15 02:03 almania

Well, I'm using it for Lua as well, on the LEGO MINDSTORMS NXT - and I was having an issue occasionally when the garbage collector had to run - maybe this is related - actually it's very likely related. Thks for the report. I am more focused on ev3dev.org (Debian Jessie on LEGO MINDSTROMS EV3) right now, but I will definitely look at this when I have time

rhempel avatar Mar 09 '15 03:03 rhempel

Hello everyone. This library is exactly what I need.Thank you very much!

TheBigFish avatar Apr 08 '15 04:04 TheBigFish