I'm updating ClearLagg and I added a command that unloads chunks. It should show memory and chunk count before and after.
Code:
Any idea on how to make it work?
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 endThe 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?