Skip to content

Commit

Permalink
Fix memory leak when objects are created inside conditional branch
Browse files Browse the repository at this point in the history
MatwayBurkow committed Dec 5, 2018
1 parent 493a49a commit 680d09b
Showing 2 changed files with 14 additions and 8 deletions.
14 changes: 7 additions & 7 deletions main.mpl
Original file line number Diff line number Diff line change
@@ -269,11 +269,11 @@ createDefinition: [
success [0][1] if
] call

#HAS_LOGS [
# cm: memoryCounterMalloc copy;
# cf: memoryCounterFree copy;
# cx: memoryXor copy;
# cu: memoryUsed copy;
# (LF "mallocs: " cm "; frees: " cf "; xors: " cx "; used: " cu LF) assembleString print
#] when
debugMemory [
cm: memoryCounterMalloc copy;
cf: memoryCounterFree copy;
cx: memoryXor copy;
cu: memoryUsed copy;
(LF "mallocs: " cm "; frees: " cf "; xors: " cx "; used: " cu LF) printList
] when
] "main" exportFunction
8 changes: 7 additions & 1 deletion processSubNodes.mpl
Original file line number Diff line number Diff line change
@@ -1391,7 +1391,13 @@ processIf: [
i: 0 dynamic;
[
i outputs.dataSize < [
i outputs.at pushOutput
outputRef: i outputs.at;
outputRef getVar.data.getTag VarStruct = [
outputRef markAsAbleToDie
outputRef @[email protected]
] when

outputRef pushOutput
i 1 + @i set TRUE
] &&
] loop

0 comments on commit 680d09b

Please sign in to comment.