[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: doubt to tolua/tolua++'s tolua_gc table.
- From: Xavier Wang <weasley.wx@...>
- Date: Sun, 26 Jun 2011 00:32:30 +0800
Has somebody still use tolua/tolua++? I don't understand how it's new_local worked.
when create a new object, tolua put it into a weak-value table named tolua_ubox, it's key is the raw-pointer of object, and it's value is the userdata of object.
but if you marked this object is "need collected", that is, you call tolua.takeownership on it or create it using new_local, then this object will be added into a table named tolua_gc, but this is not a weak table! it means, the object itself may always marked, and will not be collect.
am i missing something?
another question: the code below:
print("memory1 is: ", collectgarbage"count")
for i = 1, 1000 do
print("memory2 is: ", collectgarbage"count")
print("memory3 is: ", collectgarbage"count")
Obj is a C++ class binding by tolua, it seems that memory2 and memory3 is the same! so I don't have my memory back, how do I make my memory back after collect?