diff --git a/ext/ghoul b/ext/ghoul index c342cf9d25..26de570dec 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit c342cf9d25995b02e709fc4bcc114ef40a3a8715 +Subproject commit 26de570dec769496c7d04707325db9a390465906 diff --git a/include/openspace/scene/profile.h b/include/openspace/scene/profile.h index 71473693ee..de6aa8a2f5 100644 --- a/include/openspace/scene/profile.h +++ b/include/openspace/scene/profile.h @@ -121,7 +121,7 @@ public: * and all of the property & asset changes that were made since startup. */ void saveCurrentSettingsToProfile(const properties::PropertyOwner& rootOwner, - const std::string& currentTime, + std::string currentTime, interaction::NavigationHandler::NavigationState navState); /// If the value passed to this function is 'true', the addAsset and removeAsset diff --git a/include/openspace/util/memorymanager.h b/include/openspace/util/memorymanager.h index f50eb525e5..6d202f15ee 100644 --- a/include/openspace/util/memorymanager.h +++ b/include/openspace/util/memorymanager.h @@ -35,10 +35,8 @@ public: ghoul::MemoryPool<8 * 1024 * 1024, false> PersistentMemory; // This should be replaced with a std::pmr::memory_resource wrapper around our own - // Memory pool. Resetting the monotoic_buffer_resource costs an allocation, that we - // can prevent - std::pmr::monotonic_buffer_resource TemporaryMemory = - std::pmr::monotonic_buffer_resource(100 * 4096); + // Memory pool so that we can get a high-water mark out of it + ghoul::MemoryPool<100 * 4096, false> TemporaryMemory; }; } // namespace openspace diff --git a/modules/server/src/connection.cpp b/modules/server/src/connection.cpp index 7e1b98891c..e84baa0c35 100644 --- a/modules/server/src/connection.cpp +++ b/modules/server/src/connection.cpp @@ -85,7 +85,7 @@ Connection::Connection(std::unique_ptr s, AuthenticationTopicKey, [password](bool, const ghoul::Dictionary&, ghoul::MemoryPoolBase* pool) { if (pool) { - void* ptr = pool->alloc(sizeof(AuthorizationTopic)); + void* ptr = pool->allocate(sizeof(AuthorizationTopic)); return new (ptr) AuthorizationTopic(password); } else { diff --git a/modules/sync/syncmodule.cpp b/modules/sync/syncmodule.cpp index 582b7f2146..dc48ce9632 100644 --- a/modules/sync/syncmodule.cpp +++ b/modules/sync/syncmodule.cpp @@ -80,7 +80,7 @@ void SyncModule::internalInitialize(const ghoul::Dictionary& configuration) { "HttpSynchronization", [this](bool, const ghoul::Dictionary& dictionary, ghoul::MemoryPoolBase* pool) { if (pool) { - void* ptr = pool->alloc(sizeof(HttpSynchronization)); + void* ptr = pool->allocate(sizeof(HttpSynchronization)); return new (ptr) HttpSynchronization( dictionary, _synchronizationRoot, @@ -101,7 +101,7 @@ void SyncModule::internalInitialize(const ghoul::Dictionary& configuration) { "UrlSynchronization", [this](bool, const ghoul::Dictionary& dictionary, ghoul::MemoryPoolBase* pool) { if (pool) { - void* ptr = pool->alloc(sizeof(UrlSynchronization)); + void* ptr = pool->allocate(sizeof(UrlSynchronization)); return new (ptr) UrlSynchronization( dictionary, _synchronizationRoot diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 1b78001201..c0b79c92af 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -1062,7 +1062,7 @@ void OpenSpaceEngine::preSynchronization() { FileSys.triggerFilesystemEvents(); // Reset the temporary, frame-based storage - global::memoryManager.TemporaryMemory.release(); + global::memoryManager.TemporaryMemory.reset(); if (_hasScheduledAssetLoading) { LINFO(fmt::format("Loading asset: {}", _scheduledAssetPathToLoad)); @@ -1260,6 +1260,8 @@ void OpenSpaceEngine::postDraw() { _isFirstRenderingFirstFrame = false; } + global::memoryManager.PersistentMemory.housekeeping(); + LTRACE("OpenSpaceEngine::postDraw(end)"); } diff --git a/src/scene/profile.cpp b/src/scene/profile.cpp index f351928e2a..bbfeec0351 100644 --- a/src/scene/profile.cpp +++ b/src/scene/profile.cpp @@ -454,7 +454,7 @@ namespace { } // namespace void Profile::saveCurrentSettingsToProfile(const properties::PropertyOwner& rootOwner, - const std::string& currentTime, + std::string currentTime, interaction::NavigationHandler::NavigationState navState) { version = Profile::CurrentVersion; @@ -476,7 +476,7 @@ void Profile::saveCurrentSettingsToProfile(const properties::PropertyOwner& root // add current time to profile file // Time t; - t.time = currentTime; + t.time = std::move(currentTime); t.type = Time::Type::Absolute; time = std::move(t);