News for April 2011

Error optimizing byte code

Frustration

Actually it will, but that is beside the point...

Or, why I would sometimes like to kill and maim in the world of virtual machines. Why can’t we just all program C++. Y U NO MEMORY LEFT?!!11

When you are like me, you are writing vast, bloated pieces of Flash because you keep thinking up ridiculous requirements for your games. Let’s take our new ANWB/TNO game for example (we’re still in the market for new names, apart from “CARamba!”)

Now the first problem is connecting over a thousand road pieces. Most of it by hand, since it is all quite intricate stuff. But when I reached about half the map, my script that tries to find out what directions the car should take exploded. Stack Overflow. Kablooie.

So I could build the map up unto 15 seconds of script execution time. Which was about half the map. Now Gnuif is brilliant but still took almost a week to rewrite the code in such a way that we were able to bring execution times back to under a second. Nice going.

Then I finally fixed the Map but flash exploded in my face with it’s mysterious 5005: end of bytecode.

So I was like WT-fucking-F?!

It appears that the Java virtual machine, Java being the language in which flash is written, has a memory buffer limit of 128MB. Also for compiling. Which basically means that if you try to compile BIG flash files it blows up in your face.

Of course there is a trick. There always is. They Write about it over here and Google is actually quite helpful

[...] To do that in Windows: right click on my computer -> properties -> advanced -> environment variables -> make a new variable:

JAVA_TOOL_OPTIONS

and add this value:

-Xmx1024M

Then log out or restart.

There was an issue when I opened Flash CS4 after the restart. I got the message:
“Error initializing Java Runtime Environment. You may need to reinstall Flash.”
I had to change the value from -Xmx1024M to -Xmx256M (or -Xmx128M). A value of -Xmx512M and higher causes every time the error “Error initializing JRE. You may need to reinstall Flash”.

After I set up the variable “JAVA_TOOL_OPTIONS” with value “-Xmx256M” everything started working fine.

Sigh. Ow Adobe, why are you making my life so much harder ?

Posted: April 5th, 2011
Categories: nerd, research, web, work
Tags: , , , , , ,
Comments: No Comments.