Fixed Memory Leaks. :)
This commit is contained in:
+19
-1
@@ -41,7 +41,25 @@ proc append_to_keyword_argument_list(Keyword_Arguments* args,
|
||||
}
|
||||
|
||||
Lisp_Object::~Lisp_Object() {
|
||||
if (Memory::get_type(this) == Lisp_Object_Type::HashMap) {
|
||||
free(sourceCodeLocation);
|
||||
sourceCodeLocation = 0;
|
||||
|
||||
switch (Memory::get_type(this)) {
|
||||
case Lisp_Object_Type::HashMap: {
|
||||
this->value.hashMap.~Hash_Map();
|
||||
} break;
|
||||
case Lisp_Object_Type::CFunction: {
|
||||
this->value.cFunction->args.positional.symbols.~Array_List();
|
||||
this->value.cFunction->args.keyword.keywords.~Array_List();
|
||||
this->value.cFunction->args.keyword.values.~Array_List();
|
||||
delete this->value.cFunction;
|
||||
} break;
|
||||
case Lisp_Object_Type::Function:{
|
||||
this->value.function->args.positional.symbols.~Array_List();
|
||||
this->value.function->args.keyword.keywords.~Array_List();
|
||||
this->value.function->args.keyword.values.~Array_List();
|
||||
delete this->value.function;
|
||||
} break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user