Any idea on how to do that?
#1
I'm updating ClearLagg and I added a command that unloads chunks. It should show memory and chunk count before and after.
Code:
    elseif Split[2] == "unloadchunks" then
        Root = cRoot:Get()
        ramusage = cRoot:GetPhysicalRAMUsage() / 1024
        swapusage = cRoot:GetVirtualRAMUsage() / 1204
        totalusage = ramusage + swapusage
        local Out1 = "Num loaded chunks before: " .. cRoot:Get():GetTotalChunkCount()
        local Out2 = "Ram usage before: " .. totalusage
        Root:SaveAllChunks()
        local UnloadChunks = function(World)
            World:QueueUnloadUnusedChunks()
        end
        cRoot:Get():ForEachWorld(UnloadChunks)
        afterramusage = cRoot:GetPhysicalRAMUsage() / 1024
        afterswapusage = cRoot:GetVirtualRAMUsage() / 1204
        aftertotalusage = ramusage + swapusage
        Out3 = "Num loaded chunks after: " .. cRoot:Get():GetTotalChunkCount()
        Out4 = "Ram usage after: " .. aftertotalusage
        Player:SendMessage(Out1)
        Player:SendMessage(Out2)
        Player:SendMessage(Out3)
        Player:SendMessage(Out4)
        return true
    end
The problem is that it returns the same chunk count and ram usage before and after(probably because of QuequeUnloadUnusedChunks(), that some time ago was instant).
Any idea on how to make it work?
Reply
Thanks given by:


Messages In This Thread
Any idea on how to do that? - by tonibm19 - 03-10-2014, 04:31 AM
RE: Any idea on how to do that? - by FakeTruth - 03-10-2014, 04:54 AM
RE: Any idea on how to do that? - by worktycho - 03-10-2014, 05:01 AM
RE: Any idea on how to do that? - by xoft - 03-10-2014, 05:08 AM
RE: Any idea on how to do that? - by worktycho - 03-10-2014, 05:12 AM
RE: Any idea on how to do that? - by xoft - 03-10-2014, 06:48 AM
RE: Any idea on how to do that? - by worktycho - 03-10-2014, 06:55 AM
RE: Any idea on how to do that? - by xoft - 03-10-2014, 07:02 AM
RE: Any idea on how to do that? - by tonibm19 - 03-11-2014, 02:21 AM



Users browsing this thread: 5 Guest(s)