What alternatives to Hans Boehm GC are out there for small devices? [closed]
Asked Answered
P

3

12

I'd like to use a virtual machine like NekoVM into a small device but to build it, it requires Boehm GC, however there is no port of that GC to that small device so I was wondering if there is any alternative to it, something that could be done exclusively with C code?

Pignus answered 8/1, 2009 at 11:59 Comment(1)
My advice is to write an accurate GC for Neko if one does not already exist. I wouldn't touch Boehm's GC with a barge pole...Rhetoric
H
4

I'd say your best option would be to port the GC to your platform, for which there are instructions (libgc porting instructions).

Additionally, it should be possible to swap out the GC implementation (NekoVM FAQ), see vm/alloc.c file.

EDIT:

Hopefully useful additional links: (untested)

Hemimorphite answered 12/1, 2009 at 8:24 Comment(1)
@downvoter: Is there anything wrong with this answer? A comment would help improve it.Hemimorphite
B
3

Perhaps you'd be better off with Lua, which has a very small but powerful virtual machine, has its own garbage collector built in, and runs on any platform that supports ANSI Standard C. With just a little effort you can even build Lua on a machine that lacks standard input and standard output. I have seen Lua running on an embedded device that was a small LCD touch screen with an embedded CPU stuck on the back. Neko is good work, but I think you'll find Lua every bit as satisfying.

Brody answered 8/1, 2009 at 20:34 Comment(4)
I am aware that Lua has its own garbage collector, but if you look into NekoVM they use libgc and do not a GC like Lua because it is not as good as libgc. I'm looking for a general purpose GC like libgc that i could replace on nekoVMPignus
Hans has literally spent more than 20 years improving libgc. It is not realistic to expect to find a drop-in replacement for a high-performance collector. It is also not sensible to expect high-performance GC on a small device. Your question asked for 'a VM like NekoVM'. Lua qualifies.Brody
Hans may have spent more than 20 years improving libgc but its performance is awful compared to most accurate garbage collectors.Rhetoric
If you do the wrong design for 20 years it's not helping at all. libgc works well for small data amounts. And it got worse in 2013.Duiker
F
3

I could suggest TinyGC (tinygc.sf.net) - an independent lightweight implementation of the BoehmGC targeting small devices. It is fully API-compatible (even more, binary compatible) with BoehmGC v7+ but only a small subset of the API is implemented (but sufficient for Java/GCJ-like memory management) and there is no automatic threads and static data roots registration. The latter, however, may require some efforts to make NekoVM work with it (i.e., call GC_register_my_thread() and GC_add_roots()).

Foal answered 20/12, 2009 at 16:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.