mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
#15 Fixed some of the worst memory leaks
This commit is contained in:
@@ -32,8 +32,6 @@ void initInterpreter(Interpreter* interpreter) {
|
||||
}
|
||||
|
||||
void freeInterpreter(Interpreter* interpreter) {
|
||||
FREE_ARRAY(char, interpreter->bytecode, interpreter->length);
|
||||
|
||||
//since these are dynamically allocated, free them manually
|
||||
for (int i = 0; i < interpreter->literalCache.count; i++) {
|
||||
if (IS_ARRAY(interpreter->literalCache.literals[i]) || IS_DICTIONARY(interpreter->literalCache.literals[i]) || IS_TYPE(interpreter->literalCache.literals[i])) {
|
||||
@@ -1016,4 +1014,7 @@ void runInterpreter(Interpreter* interpreter, unsigned char* bytecode, int lengt
|
||||
}
|
||||
|
||||
execInterpreter(interpreter);
|
||||
|
||||
//free the bytecode immediately after use
|
||||
FREE_ARRAY(unsigned char, interpreter->bytecode, interpreter->length);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user