4 ms·
Jai has no GC though, which is critical in game dev.
by Cyph0n 7y ago
Jai has no GC though, which is critical in game dev.
- shakna 7y agonimc --gc:none Nim has 5 GCs to choose from, as well as being able to have none at all.
- Cyph0n 7y agoThat’s great, but can you use the Nim stdlib with no GC?
- shakna 7y agoYes, but you'll need to call dealloc [0] on the result of any call, unless you want to leak memory. [0] https://nim-lang.org/docs/system.html#dealloc%2Cpointer https://nim-lang.org/docs/system.html#dealloc%2Cpointer
- beagle3 7y agoYes, with some relatively minor caveats, mostly having to release memory yourself. Also, the arc/orc GC is shaping up and already allows you to use exclusively reference counted memory management - so, efficient and perfectly deterministic timing but still get automatic memory management. (As usual, if you introduce cycles, it becomes more complicated) And the Nim compiler elides many ref/unref ops, as well as keeping objects thread-local, so most performance objections to ref counting don’t actually apply. (.... and you have a choice of other automatic GC modes, including “none”)
- Cyph0n 7y agoGood to know. Thanks for the explanation.
- renox 7y agoAnd D has the DasBetterC mode, but I'm not sure that's good enough: when the language has a GC by default, all the libraries use it, the APIs relies on it.. What good is a language if you can't (easily) use its libraries?
- beagle3 7y agoNim’s relationship with GC is very different than any other language that I’ve used. It has very different selectable GC systems - Boehm, Bacon/Dingle, reference counting, or real-time deadline mark-and-sweep, and “none”. Perhaps I forgot one. Some libraries rely on a specific GC behavior but most work with any (with the caveat that “none” requires you to manually deal with garbage). Nim’s mark-and-sweep is suitable for embedded systems and games, unlike Java’s, and so is the ref counting one; but even if none of the GCs work for you, the fact that there’s many of them and they are mostly interchangeable means that the dependency on them is much, much weaker than you are used to (although it still exists)
- pjmlp 7y agoJust like Java actually, each implementation has its own set of algorithms including none.
- jug 7y agoThe GC can also run incrementally to meet deadlines. It’s not like a Java GC. It has been used in microcontrollers. People should probably learn more about it before shooting it down based on the word GC.
- pjmlp 7y agoJava GC also has been used in microcontrollers, with soft real time deadlines, there are plenty of JVM vendors out there, including a couple that are only focused on embedded development like PTC, Aicas, Gemalto, microEJ, Virtenio.
- nimmer 7y agoYou can use Nim in games using deterministic, real-time GC. Also, the new ARC memory management will replace GC https://forum.nim-lang.org/t/5734 https://forum.nim-lang.org/t/5734