[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/native-comp ab78ed8 3/4: * Fix memory leak when native compiled
From: |
Andrea Corallo |
Subject: |
feature/native-comp ab78ed8 3/4: * Fix memory leak when native compiled function is collected |
Date: |
Thu, 11 Jun 2020 13:33:49 -0400 (EDT) |
branch: feature/native-comp
commit ab78ed83b977084885265a1842e4e474e0938d9f
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>
* Fix memory leak when native compiled function is collected
* src/alloc.c (cleanup_vector): Handle native compiled
functions.
---
src/alloc.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/alloc.c b/src/alloc.c
index 9a9dbb5..750ffbd 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -3156,6 +3156,17 @@ cleanup_vector (struct Lisp_Vector *vector)
PSEUDOVEC_STRUCT (vector, Lisp_Native_Comp_Unit);
dispose_comp_unit (cu, true);
}
+ else if (NATIVE_COMP_FLAG
+ && PSEUDOVECTOR_TYPEP (&vector->header, PVEC_SUBR))
+ {
+ struct Lisp_Subr *subr =
+ PSEUDOVEC_STRUCT (vector, Lisp_Subr);
+ if (subr->native_comp_u[0])
+ {
+ xfree (subr->symbol_name);
+ xfree (subr->native_c_name[0]);
+ }
+ }
}
/* Reclaim space used by unmarked vectors. */