Gridview not deallocating on removing / memory leak

System: SDK 1.11.1, on M1 iMac, Nova, macOS 12.4

Expected: When creating a gridview, and then subsequently setting it to nil, it's expected that the memory is properly released (or, that there is a dedicated :remove function on ui.gridview?)

Repro: Run the below project, press A repeatedly to create and remove gridviews. Check malloc map to see consistent increases in heap usage.

Notes: I'm pretty green with memory allocation stuff, so I may not understand how Lua or the SDK is supposed to handle things when set to nil. If there's a proper way to "destroy" something like this and I'm not aware, please let me know ! (137.9 KB)


Update: As of the 1.12.0 update, this "leak" (or whatever was happening) is fixed! I couldn't find anything specific in the changelog that mentioned anything about changes to gridview, but I'm glad it's fixed. :slight_smile: Thank you devs !

1 Like

Hate to revive this from the dead, but it seems to have been reintroduced in either 1.12.1 or 1.12.2.

To repro, just download again the project above "" and run it in 1.12.2, and press A repeatedly. View the malloc map to see continual increase.

This is relevant (and I realized it again) because I'm using it in a project where I'm creating and destroying gridviews somewhat often.

Any ideas on what this could possibly be?

Hey, it seems I've run into this bug too!
From what I can tell timerX and timerY are not being removed.
I've added this to the removal of my gridview and it seems to have helped.

self.grid = nil

where self.grid is a reference to my grid view

1 Like

This is interesting as it raises the question of what is actually removed. Let's say we have a class extending sprite but in which we had a timer and potentially other stuff.
Are the other variables/objects deallocated when we do mySprite:remove() or do we also need to do mySprite.myTimer:remove() (and would we need to set a table to nil for instance?)