ModDota/BugTracker

Crash & Memory leak with CustomNetTables:GetTableValue

CryDeS opened this issue · 2 comments

Frequent issues to GetTableValue in net-tables cause memory leak that crash dedicated server

Simple example:

local net_tables = {} 
for i = 0, 10000000 do 
        local net_table = CustomNetTables:GetTableValue("heroes", "test_table") or {}
        table.insert(net_tables, net_table)
end 
net_tables = nil 

That call allocate ~1.5GB RAM on server, that will be cleared not completely (~100-150MB will leak).

If you try call it every game tick - after 30 minute dota dedicated server will crash.

That also cause some spam messages to console(and completly that spam are right)

LUA Memory usage warning: The VM has hit a new high usage of 1,685,061,632 bytes.

Calling garbage collector manually doesn't help at all( 0 items collected ), but counting lua memory will print something about ~10Mb.


Also that problem(2015 YEAR!):
https://dev.dota2.com/showthread.php?t=184696


I think that NEED to be fixed. Or custom developers must have another way to sync server with client.

CustomNetTables:GetTableValue
CustomNetTables:SetTableValue
do not cause leak, but there is problem with lua garbage collector (or just lack of knowlege of it)

I wonder if we can close this for summer scrub
http://www.dota2.com/summerscrub