Printing Creates Memory Leaks

When printing to the Roblox Studio Output Window, it appears that the memory usage never goes down, even if you clear the Output Window from the button or re-testing. This can occur from repeatedly printing strings over and over, and is very noticeable when printing tables.

Here is some example code to create this on a large effect with a large table:

local tbl = table.create(99999, 1)

while true do
	task.wait()
	print(tbl)
end

Simply stop playtesting after a few seconds of running this code, clear the console, and your memory usage should be very high. If you want to test this on a smaller scale, change the table.create(99999, 1) to table.create(1, 1).

In the video you can see that even after clearing the output window, and retesting, the memory usage remains super high.

Tested on Windows 11, Mac.

Expected behavior

I expect memory usage to increase due to me printing tables, and the memory usage to decrease back to normal when the output window is cleared.

1 Like

Afaik, this isn’t exactly going to be the case (at least immediately) since garbage-collection really only needs to remove memory if the CPU is under low-memory circumstances. Is Roblox Studio able to crash over this?

1 Like

I accidentally left my computer AFK for a little while during this, which resulted in my memory going to 99%. I had cleared everything, and waited a bit, nothing happened, my entire computer was understandably unstable, and a few times studio did fully freeze, but it never crashed. It was also incredibly hard to close, it broke my Task Manager, I had to taskkill it from the command prompt.

Thanks for the report! Just to confirm, we have a ticket filed in our internal database for this issue.

1 Like