Load and destroy methods revised for proper reference counting
The update enhances object management by involving scope-based reference counting. The change affects loading and destruction operations in the Object and several other classes, ensuring the release or retention of objects adhere to their usage context. A function for logging type data has also been introduced to provide better clarity during debugging. Also, tests in script & interpreter have been altered to run in separate module initializations to avoid cross-test interference. Overall, it provides better memory management and dependable tests.
This commit is contained in:
parent
ab0edfc302
commit
3f4f2caf1f
12 changed files with 58 additions and 10 deletions
|
|
@ -150,6 +150,8 @@ void load_constants(ScriptSection* self, ArchiverIn& file, tp::alni start_addr)
|
|||
// script text
|
||||
tp::alni str_addr;
|
||||
file >> str_addr;
|
||||
|
||||
NDO->destroy(script->mReadable); // we already have string object in the script when creating script
|
||||
script->mReadable = NDO_CAST(obj::StringObject, obj::NDO->load(file, str_addr));
|
||||
|
||||
file.setAddress(file.getAddress() + sizeof(tp::alni)); // constants length
|
||||
|
|
@ -257,6 +259,7 @@ void ScriptSection::initialize() {
|
|||
void ScriptSection::uninitialize() {
|
||||
ASSERT(gScriptSection);
|
||||
delete gScriptSection;
|
||||
gScriptSection = nullptr;
|
||||
}
|
||||
|
||||
ScriptSection* ScriptSection::globalHandle() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue