[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: mochalua heap memory issues?
- From: Raymond Jacobs <raymondj@...>
- Date: Fri, 6 Nov 2009 09:08:31 -0500
I wanted to follow up with this; as I discovered the issue.
It is not mochalua's fault, though with a lack of documentation it is potentially easy to fall into this trap.
luaL_loadstring takes a String type, but only accepts binary data within the string type;
Java has some rather weasily functions when it comes to converting a byte to a String.
In my cause it caused 'some' of my bytes to be transcoded based on the current locale;
enough that most of lua chunk would be deserialized; however in one case the int length prefix of a string
constant was changed, resulting in a smaller number; this caused an under-read of the subsequent string
the subsequent int read was the number of lua functions which turned out to be wrong; resulting in a LARGE int value;
this int value is promptly used as the quantity for an array of LuaFunctions; but the large size causes an instant out of memory
Only through inspecting what was going in by attaching the mochalua source; and a lot of time, was I able to figure this out.
Due to the nature of system specific encoding; and the varied nature of input files, it's potential that people could have this issue and not even know about it; as trivial scripts worked fine for me. and the out of memory error didint point to anything being wrong in my bytecode data.
On Thu, Nov 5, 2009 at 10:22 AM, Raymond Jacobs <firstname.lastname@example.org>
I hope it is alright posting about mochalua here;
I couldn't seem to find a good spot to talk about mochalua elsewhere.
I've recently started using mochalua in my Java 1.6 SE application;
and while I can get small, trivial lua code to run; a larger multi-function script
results in a Java out of heap memory exception.
I've tried to set the xms and xmm VM arguments to up the JVM heap size but nothing seems to be helping.
I am using luaL_loadstring to load the data;
has anyone had similar issues when working with mochalua?
Any information is appreciated,
Ethereal Darkness Interactive