Synopsis
rename introduces calls to initArray, but does not insert a corresponding freeArray, which leads to a potential memory leak.
Background
Discovered in #197.
In 163e3f0 the compilation of Let constructs is changed to not initialize and free the variable bound, since doing that may lead to multiple frees of the same variable through aliasing. Instead, the variable is declared as an alias.
This change uncovered an issue in renameExp where the call to deepCopy introduces a call to initArray without a corresponding freeArray.
Solutions?
- A crude solution is to emit an epilogue snippet in
deepCopy and applying that when the let-bound variable goes out of scope.
/cc @pjonsson
Synopsis
renameintroduces calls toinitArray, but does not insert a correspondingfreeArray, which leads to a potential memory leak.Background
Discovered in #197.
In 163e3f0 the compilation of
Letconstructs is changed to not initialize and free the variable bound, since doing that may lead to multiple frees of the same variable through aliasing. Instead, the variable is declared as an alias.This change uncovered an issue in
renameExpwhere the call todeepCopyintroduces a call toinitArraywithout a correspondingfreeArray.Solutions?
deepCopyand applying that when the let-bound variable goes out of scope./cc @pjonsson