Fixing array deallocation leak (#317)
* Fixing array deallocation leak * Moving delete down to the individual destroy methods
This commit is contained in:
parent
c85b6f9507
commit
21473f5b9b
@ -117,7 +117,6 @@ namespace pxt {
|
||||
|
||||
void RefObject::destroy() {
|
||||
((RefObjectMethod)getVTable()->methods[0])(this);
|
||||
delete this;
|
||||
}
|
||||
|
||||
void RefObject::print() {
|
||||
@ -132,6 +131,7 @@ namespace pxt {
|
||||
if (refmask[i]) decr(r->fields[i]);
|
||||
r->fields[i] = 0;
|
||||
}
|
||||
delete r;
|
||||
}
|
||||
|
||||
void RefRecord_print(RefRecord *r)
|
||||
@ -242,6 +242,7 @@ namespace pxt {
|
||||
this->data[i] = 0;
|
||||
}
|
||||
this->data.resize(0);
|
||||
delete this;
|
||||
}
|
||||
|
||||
void RefCollection::print()
|
||||
@ -258,6 +259,7 @@ namespace pxt {
|
||||
decr(fields[i]);
|
||||
fields[i] = 0;
|
||||
}
|
||||
delete this;
|
||||
}
|
||||
|
||||
void RefAction::print()
|
||||
@ -272,6 +274,7 @@ namespace pxt {
|
||||
|
||||
void RefLocal::destroy()
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
PXT_VTABLE_CTOR(RefLocal) {
|
||||
@ -290,6 +293,7 @@ namespace pxt {
|
||||
void RefRefLocal::destroy()
|
||||
{
|
||||
decr(v);
|
||||
delete this;
|
||||
}
|
||||
|
||||
PXT_VTABLE_BEGIN(RefMap, 0, RefMapMarker)
|
||||
@ -304,6 +308,7 @@ namespace pxt {
|
||||
data[i].val = 0;
|
||||
}
|
||||
data.resize(0);
|
||||
delete this;
|
||||
}
|
||||
|
||||
int RefMap::findIdx(uint32_t key) {
|
||||
|
Loading…
Reference in New Issue
Block a user