Question

In my Android application I'm getting

E/dalvikvm: HeapWorker is wedged: 10629ms (generally more than 10 sec) spent inside Lorg/keplerproject/luajava/LuaObject;.finalize()V

Searched for the answer and found information about garbage collector mainly. After that I've removed all finilizers from my code. It did not help. Moving sqlite operations to transaction had no use as well.

The situation is:

I've got LuaTable which I iterate to execute some actions with values:

local myTable = getTable() -- function that returns table of values
for i,v in ipairs(myTable) do
    someFunction(v)
end

The table is big (almost 1000 values). And the actions to values are following:

  1. Create java object basing on value information
  2. Query the db (result - in Cursor) during the java object creation

The hole time for executing the script turns up to be rather long (I run the script via function LuaState.pcall). So my research led me to the following results: - when I handled about 15 values (of 1000) the 'finalize' method is called; - but the script is still executing, so LuaState object seems to be locked (Mast3rPlan, thank you for comment!). And it will be locked more than 10 seconds for sure (as there almost 1000 values to handle). And all this time synchronization block of finilize cannot be entered. So the application crashes. Note that even removing braces of synchronization block has no use. In such a case LunRef method is locked (see finalize method).

Is it problem in LuaJava API? Or there is another way to execute scripts and have no problems with finalize?

Thanks in advance for help!

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top