2008-10-18 02:32:34 +02:00
|
|
|
/*
|
2008-10-30 04:34:05 +01:00
|
|
|
AllocationCluster - allocating and owning a pile of objects
|
2010-12-17 23:28:49 +01:00
|
|
|
|
2008-10-18 02:32:34 +02:00
|
|
|
Copyright (C) Lumiera.org
|
|
|
|
|
2008, Hermann Vosseler <Ichthyostega@web.de>
|
2010-12-17 23:28:49 +01:00
|
|
|
|
2008-10-18 02:32:34 +02:00
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
|
modify it under the terms of the GNU General Public License as
|
2010-12-17 23:28:49 +01:00
|
|
|
published by the Free Software Foundation; either version 2 of
|
|
|
|
|
the License, or (at your option) any later version.
|
|
|
|
|
|
2008-10-18 02:32:34 +02:00
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
2010-12-17 23:28:49 +01:00
|
|
|
|
2008-10-18 02:32:34 +02:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
2010-12-17 23:28:49 +01:00
|
|
|
|
2008-10-18 02:32:34 +02:00
|
|
|
* *****************************************************/
|
|
|
|
|
|
|
|
|
|
|
2016-11-03 18:22:31 +01:00
|
|
|
/** @file allocation-cluster.cpp
|
2016-11-08 13:18:05 +01:00
|
|
|
** Implementation of [memory management helper functions](\ref allocation-cluster.hpp)
|
|
|
|
|
** for the render engine model. Here, in the actual translation unit, the generic part
|
|
|
|
|
** of these functions is emitted, while the corresponding header provides a strictly
|
|
|
|
|
** typed front-end, based on templates, which forward to the implementation eventually.
|
2016-11-03 18:20:10 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2010-12-18 00:58:19 +01:00
|
|
|
#include "lib/allocation-cluster.hpp"
|
2008-12-27 00:53:35 +01:00
|
|
|
#include "lib/error.hpp"
|
2008-12-17 17:53:32 +01:00
|
|
|
#include "lib/util.hpp"
|
2008-10-18 02:32:34 +02:00
|
|
|
|
2023-06-11 04:37:38 +02:00
|
|
|
|
2008-10-23 23:08:27 +02:00
|
|
|
using util::isnil;
|
2008-10-30 04:34:05 +01:00
|
|
|
|
2008-10-18 02:32:34 +02:00
|
|
|
|
|
|
|
|
namespace lib {
|
|
|
|
|
|
2008-10-30 04:34:05 +01:00
|
|
|
|
|
|
|
|
|
2008-10-18 02:32:34 +02:00
|
|
|
/** creating a new AllocationCluster prepares a table capable
|
|
|
|
|
* of holding the individual object families to come. Each of those
|
|
|
|
|
* is managed by a separate instance of the low-level memory manager.
|
|
|
|
|
*/
|
|
|
|
|
AllocationCluster::AllocationCluster()
|
|
|
|
|
{
|
2008-11-28 21:45:18 +01:00
|
|
|
TRACE (memory, "new AllocationCluster");
|
2008-10-18 02:32:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** On shutdown of the AllocationCluster we need to assure a certain
|
|
|
|
|
* destruction order is maintained by explicitly invoking a cleanup
|
|
|
|
|
* operation on each of the low-level memory manager objects.
|
|
|
|
|
*/
|
2018-04-26 12:07:08 +02:00
|
|
|
AllocationCluster::~AllocationCluster() noexcept
|
2008-10-18 02:32:34 +02:00
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2008-10-23 23:08:27 +02:00
|
|
|
|
2024-05-15 22:46:14 +02:00
|
|
|
TRACE (memory, "shutting down AllocationCluster");
|
2008-10-23 19:47:08 +02:00
|
|
|
|
|
|
|
|
}
|
2024-05-15 22:46:14 +02:00
|
|
|
ERROR_LOG_AND_IGNORE (progress, "discarding AllocationCluster")
|
2008-10-22 04:55:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-04-30 04:28:16 +02:00
|
|
|
/* === diagnostics helpers === */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-10-18 02:32:34 +02:00
|
|
|
} // namespace lib
|