From 295597008e0464f57eb52f51dc5d91ecb4e20cde Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 4 Feb 2024 13:59:58 +0100 Subject: src/world: remove automatic garbage collection It should be run in the update loop. --- src/world.cpp | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'src/world.cpp') diff --git a/src/world.cpp b/src/world.cpp index b393a403..59ea8d3d 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -45,8 +45,6 @@ world& world::operator=(world&& w) noexcept _chunks = std::move(w._chunks); _objects = std::move(w._objects); w._objects = safe_ptr{}; - _last_collection = w._last_collection; - _collect_every = w._collect_every; _unique_id = std::move(w._unique_id); fm_debug_assert(_unique_id); fm_debug_assert(w._unique_id == nullptr); @@ -120,24 +118,16 @@ bool world::contains(chunk_coords_ c) const noexcept void world::clear() { fm_assert(!_teardown); - _last_collection = 0; _chunks.clear(); _chunks.rehash(initial_capacity); _objects->clear(); _objects->rehash(initial_capacity); - _collect_every = initial_collect_every; _object_counter = object_counter_init; auto& [c, pos] = _last_chunk; c = nullptr; pos = chunk_tuple::invalid_coords; } -void world::maybe_collect() -{ - if (_chunks.size() > _last_collection + _collect_every) - collect(); -} - void world::collect(bool force) { const auto len0 = _chunks.size(); @@ -150,7 +140,6 @@ void world::collect(bool force) ++it; } - _last_collection = _chunks.size(); auto& [c, pos] = _last_chunk; c = nullptr; pos = chunk_tuple::invalid_coords; -- cgit v1.2.3