From 7e9e7f79110e398a4d2b07de3093eaccd551f013 Mon Sep 17 00:00:00 2001 From: LogicParrot Date: Sat, 3 Sep 2016 18:38:29 +0300 Subject: Configurable dirty unused chunk cap to avoid RAM overuse (#3359) Configurable dirty unused chunk cap to avoid RAM overuse --- src/Chunk.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/Chunk.cpp') diff --git a/src/Chunk.cpp b/src/Chunk.cpp index 06d5eb319..d833feea5 100644 --- a/src/Chunk.cpp +++ b/src/Chunk.cpp @@ -223,6 +223,19 @@ bool cChunk::CanUnload(void) +bool cChunk::CanUnloadAfterSaving(void) +{ + return + m_LoadedByClient.empty() && // The chunk is not used by any client + m_IsDirty && // The chunk is dirty + (m_StayCount == 0) && // The chunk is not in a ChunkStay + (m_Presence != cpQueued) ; // The chunk is not queued for loading / generating (otherwise multi-load / multi-gen could occur) +} + + + + + void cChunk::MarkSaving(void) { m_IsSaving = true; -- cgit v1.2.3