4 ms·
Since Haxe looks like it was made with cross-platform gaming in mind, how does it deal with GC issues? How hard is it to use when you have to go into that "no
by Pxtl 13y ago
Since Haxe looks like it was made with cross-platform gaming in mind, how does it deal with GC issues? How hard is it to use when you have to go into that "no create or destroy" main-loop? I assume this varies depending on target platform.
- jdk 13y agoHaxe is a garbage-collected language, and in general, it uses the GC of the target platform (the C++ target includes a runtime with a conservative collector). So you'll run into the typical issues with writing game code in a GC language - being careful about allocations and deep reference hierarchies, pooling/reusing objects, etc. Haxe doesn't really change anything here. Haxe does expose some platform-specific features that help though, such as C# structs and pointers/unsafe code, as well as platform-specific API's for interacting with the garbage collector (e.g. http://api.haxe.org/cpp/vm/Gc.html http://api.haxe.org/cpp/vm/Gc.html). You can take advantage of these while still writing cross-platform code with the usual tricks of conditional compilation.
- jdonaldson 13y agoGC is required for all Haxe targets. As you suggest, in some cases it's provided through default haxe libraries (on C++), and in other cases it's provided by the runtime (flash, js, etc.) I've never had it remove something that I needed to rely on via the main loop. It's almost always the opposite (it doesn't remove things or doesn't remove them fast enough, and I have to use object pooling, etc.)