All objects which are not referenced, are free for garbage collection. For example, if you have stored a table in a variable and set this variable nil, the table could not be accessed any more and will be cleared. But if you have another variable pointing to the same table, the table would of course stay in memory. Same goes for functions.
Frames cannot be deleted/collected, they just stay in memory. And, concerning strings, I think they are stored in a global place of the Lua environment and they won't be deleted, too.
Garbage-collection is actually a good thing, because it helps to delete unnecessary objects which would otherwise take up memory.
You should rather focus on the rate your memory is increasing - which of course sets a lot objects free which later become obsolete and will be garbage-collected. So, look when memory-increase or garbage-collection of your addon has a peak and then go in your addon and look which code was executed at this specific time. Make sure that you do not create a lot of new tables and/or frames which won't be used again. This mistake could often happen when you are using tables within OnUpdate-functions or often called events.
|