Event and thread memory leak?

whenever I create a thread or fire an event some KB are left after the garbage collector

Reproduction:

  • Create a new resource with a client script
  • Register an event that that create any variable
  • Register a command that triggers the event and collect the garbage after some seconds using collectgarbage(“collect”)

If you open the game, use the resmon command, you will see that everytime the command is triggered, and the garbage collector clear the memory, some memory is apparently leaked.

Example

AddEventHandler("test", function()
    local a =
    "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaddddddddddddddddddddddddddddddddddddddddddbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
end)

RegisterCommand("memory-TEST", function()
    TriggerEvent("test")
    Wait(2500)
    collectgarbage("collect")
end)

First event call memory usage: 223.64kb
Second event call memory usage: 223.92kb
Third event call memory usage: 224.30kb

Perhaps the re-registering of the command triggers it?

The command is registered once