Let us see the following codes.
do
local a = {1,2,3}
function a:doSth()
self = nil
end
a:doSth()
if a then
print("Still has a...")
end
end
I found that this method doesn't work. The table a
still exists. Why?
I know the a = nil
can reclaim the memory which table a
holds.
How to directly get the memory holds by the table a
and free the memory just like delete
in C++?