Problem
Currently, there are still not enough tools for us to properly track down memory leaks.
Right now, we can determine automatically that there is a potential leak using the existing API GetMemoryUsageMbForTag
. But we cannot granularly determine what is causing it and where, only the fact that the Lua heap is rising.
We can use the developer console to view individual scripts and custom memory tags, but the developer console uses StatsItems under game:GetService("Stats").PerformanceStats.Memory.PlaceScriptMemory
which have functions that are inaccessible to us.
We are able to create our own memory tag definitions under the memory stats in Dev Console using debug.setmemorycategory()
, such as the examples in this screenshot.
We can view this on a live game, but we cannot programmatically access them with scripts.
Request
It would be nice if we could track those individual memory stats for ourselves in order to trace down potential memory leaks. For example, if we were able to query these ourselves, we could set up analytics for automatic memory leak detection for debugging.
It is not practical for us to constantly sit in a lobby trying to figure out what grows overtime, but this is basically our only current solution to finding and guessing where memory leaks may be.
Roblox themselves can access this data using StatsItems as value holders as shown below
But we cannot access this as developers because they are a protected instance
Ideally, we can get our own version of this API something along the lines of StatsService:GetCustomMemoryCategories()
so that we can access this with scripts.