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
|
|
@ -47,6 +47,7 @@ void ClassObject::load(ArchiverIn& file_self, ClassObject* self) {
|
|||
alni ndo_object_adress;
|
||||
file_self >> ndo_object_adress;
|
||||
self->members = NDO_CAST(DictObject, NDO->load(file_self, ndo_object_adress));
|
||||
NDO->refinc(self->members);
|
||||
}
|
||||
|
||||
tp::Buffer<Object*> childs_retrival(ClassObject* self) {
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ void DictObject::load(ArchiverIn& file_self, DictObject* self) {
|
|||
file_self >> key;
|
||||
|
||||
// add to dictinary
|
||||
self->items.put(key, val);
|
||||
self->put(key, val);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ void LinkObject::load(ArchiverIn& file_self, LinkObject* self) {
|
|||
}
|
||||
else {
|
||||
self->link = NDO->load(file_self, saved_object_adress);
|
||||
NDO->refinc(self->link);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ void ListObject::load(ArchiverIn& file_self, ListObject* self) {
|
|||
for (alni i = 0; i < len; i++) {
|
||||
alni ndo_object_adress;
|
||||
file_self >> ndo_object_adress;
|
||||
self->items.pushBack(NDO->load(file_self, ndo_object_adress));
|
||||
self->pushBack(NDO->load(file_self, ndo_object_adress));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue