diff options
| author | dgp <dgp@users.sourceforge.net> | 2018-03-11 21:15:27 (GMT) |
|---|---|---|
| committer | dgp <dgp@users.sourceforge.net> | 2018-03-11 21:15:27 (GMT) |
| commit | de9c1aff4a1dd50ecf2537baf11a17873e72a41a (patch) | |
| tree | 92a72153f261810c95e1161455691942fdacb2a7 | |
| parent | a0374a6e61102ea76e2df357b648e1530508a973 (diff) | |
| parent | e7a5b8aaa5817974ac8a090530f79af42ea60544 (diff) | |
| download | tcl-de9c1aff4a1dd50ecf2537baf11a17873e72a41a.zip tcl-de9c1aff4a1dd50ecf2537baf11a17873e72a41a.tar.gz tcl-de9c1aff4a1dd50ecf2537baf11a17873e72a41a.tar.bz2 | |
plug memleaks
| -rw-r--r-- | generic/tclOO.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/generic/tclOO.c b/generic/tclOO.c index c6ea91d..587e46d 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -552,6 +552,15 @@ KillFoundation( { Foundation *fPtr = GetFoundation(interp); + /* + * Crude mechanism to avoid leaking the Object struct of the + * foundation components oo::object and oo::class + * + * Should probably be replaced with something more elegantly designed. + */ + while (TclOODecrRefCount(fPtr->objectCls->thisPtr) == 0) {}; + while (TclOODecrRefCount(fPtr->classCls->thisPtr) == 0) {}; + TclDecrRefCount(fPtr->unknownMethodNameObj); TclDecrRefCount(fPtr->constructorName); TclDecrRefCount(fPtr->destructorName); @@ -934,10 +943,26 @@ ReleaseClassContents( TclDecrRefCount(filterObj); } ckfree(clsPtr->filters.list); + clsPtr->filters.list = NULL; clsPtr->filters.num = 0; } /* + * Squelch our instances. + */ + + if (clsPtr->instances.num) { + Object *oPtr; + + FOREACH(oPtr, clsPtr->instances) { + TclOODecrRefCount(oPtr); + } + ckfree(clsPtr->instances.list); + clsPtr->instances.list = NULL; + clsPtr->instances.num = 0; + } + + /* * Squelch our metadata. */ |
