What is untracked memory exactly?

What is untracked memory exactly? what can it range from I know that if you do not disconnect connections properly this can add to it, what other things can?

Untracked memory tends to be memory which can be GC’ed by roblox, and once it hits a certain level it gets cleaned out. Memory leaks, undisconnected events, etc won’t show up in this section since technically they’re not issues with the code or untracked. Exploits, to my knowledge, can add to this but it is extremely unreliable and shouldn’t be used within proper anti exploits.

1 Like

Developer Console docs:

So I guess it’s just like miscellaneous memory usage.

3 Likes

You do not have to worry about untracked memory as it’s handled internally by ROBLOX. You do not have access to managing memory on a heap level.
All ROBLOX resources and memory which is accessible to you are stored on the stack. Which is automatically collected and managed by a garbage collector.

On a more technical level, memory leaks are caused by an application failing to keep a reference to resources which are allocated on the heap.
Memory allocated on the heap must be deleted (freed) by the application that initialized it. The programmer is in charge of making sure that all memory they allocate on the heap is properly handled and deleted throughout the application’s life span.

An example of stack and heap could be explained through variable scopes.

function StackFunction() -- Beginning of StackFunction scope.
    local x = 1
end -- "x" no longer exists after this line. (End of StackFunction scope)

The variable x is declared on the stack. "x" is initialized on the stack and remains alive for the duration of StackFunction’s scope.

If ROBLOX were to allow you to allocate memory on the heap. Such as the C++ language, it would be along the lines of the following:

function HeapFunction() -- Beginning of HeapFunction scope.
    int* x = new int(1)
end -- End of HeapFunction scope

int* would indicate to the program that it’s a memory address for an integer stored on the heap (4 bytes). The memory address will look like 0x0F032010. Which is a location in memory.

Since we don’t call delete on "x" before the end of the HeapFunction scope, variable "x" will be lost and the 4 bytes of memory will no longer be accessible to us. The 4 bytes cannot be used by another program as it’s not free memory.

If we were to run this in a loop. We will eventually cause the computer to blue screen as not enough free memory is available for applications to use. The only way to fix a memory leak is to restart the computer. Which cleans out all memory and frees it again for the next boot cycle.

6 Likes