You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When passing an object to Lua via MaxLua, then for each object passed, an wrapper object is generated - and GC_FREE'd at the end.
Returning an array of objects, will create a wrapper for each entry in the array - instead of passing the array itself.
Means if you want to iterate over a list (or array) of 1000 blitzmax objects from inside Lua, this will create 1000 new wrapper objects each time you do such an iteration over this list.
Question: is there a way to get rid of that wrapper object generation? Especially when passing around "read only" stuff (iterating over an array or list - without adding/removing the elements in it) ?
Or ... simply when returning objects as a method/function call result (... exception here might be if you return a new TMyType which needs to be retained then of course ... or not?).
Example to replicate the problem:
Open brl.mod/maxlua.mod/lua_object.c:
#include<brl.mod/blitz.mod/blitz.h>#include<pub.mod/lua.mod/lua-5.1.4/src/lua.h>intgccall=0; // ADD THIS LINE
...
...
// MODIFY THIS FUNCTIONintlua_gcobject( lua_State*L ){
void*p;
p=lua_touserdata( L,1 );
structBBObjectContainer*uc=*(structBBObjectContainer**)p;
GC_FREE(uc);
// ADD THISgccall+=1;
printf("LUA: gccall %i\n", gccall);
fflush(stdout);
return0;
}
When passing an object to Lua via MaxLua, then for each object passed, an wrapper object is generated - and GC_FREE'd at the end.
Returning an array of objects, will create a wrapper for each entry in the array - instead of passing the array itself.
Means if you want to iterate over a list (or array) of 1000 blitzmax objects from inside Lua, this will create 1000 new wrapper objects each time you do such an iteration over this list.
Question: is there a way to get rid of that wrapper object generation? Especially when passing around "read only" stuff (iterating over an array or list - without adding/removing the elements in it) ?
Or ... simply when returning objects as a method/function call result (... exception here might be if you return a
new TMyType
which needs to be retained then of course ... or not?).Example to replicate the problem:
Open brl.mod/maxlua.mod/lua_object.c:
This will show you a count of about 100.000 like this:
LUA: gccall 99994
.The text was updated successfully, but these errors were encountered: