I encountered an “Out of memory” error while compiling in Flashdevelop. I enabled
<haxeflag name="-dce full" /> flag, and everything went smoothly after that. Then i tried to load some meshes using away3D but i encountered another error in the way “Uncaught exception - $nargs”. So i disabled the dce full flag and the models loaded with no problem. After some hours of working, the “Out of memory” error showed up again! Anybody knows a solution?
Do you know what format of model you used when you had DCE runtime errors?
Does “Out of Memory” occur when compiling only on the Neko target, or does it occur on other targets, too?
Thanks for the quick reply Singmajesty!!
I am importing 1 model in AWD, and you were right. I does not crash on Flash, just on Neko. I was using a gamepad so i wasnt compiling on flash regularly.
I don’t see
$nargs in Away3D or OpenFL, but it is used in Actuate. Are you using Actuate, or another haxelib in the project?
You may need to
@:keep objects or properties that you try and tween, to make sure they are not removed from dead code elimination
Well, i got Actuate at the project.xml but i have not been using it and no Actuate classes has been imported into the project. This specific error was encountered when i was adding an Asset3DLibrary event listener to load something. Another library i am using is Nape, but as long as i used the release build, everything went smoothly. Removing Actuate does not solving anything. Here is the error when loading an asset with dce -full.
Thanks for the stack trace, it sounds like perhaps we should use
Class.new like in this blog post:
Thank you for the help, but i don’t really get it. What are the advantages of using this?
We can think about changes like that later.
For now, this fixes the problem on my machine
That did it!! Thanks Singmajesty.
When you use
Type.createInstance(), DCE may remove the constructor from your compiled binary. Then my guess is that
createInstance() will just use some kind of default constructor (no arguments, calls
super() and does nothing else). But since you’re passing one argument (
createInstance(), there are the wrong number of arguments. Hence “Uncaught exception - $nargs.”
When you use
Class.new, DCE can tell that the constructor is in use, so it doesn’t remove it.
The temporary solution (
@:keepSub) also works, but the problem with that is it’ll keep every method of every subclass, even subclasses and methods that aren’t used.