]> www.ginac.de Git - ginac.git/commit
[BUGFIX] Reclaiming the memory allocated for static objects *is* necessary.
authorAlexei Sheplyakov <varg@theor.jinr.ru>
Tue, 19 Aug 2008 11:39:46 +0000 (15:39 +0400)
committerAlexei Sheplyakov <varg@theor.jinr.ru>
Tue, 9 Sep 2008 10:17:07 +0000 (14:17 +0400)
commitaff357309f6611a59efb10d06d3dcfd3812a9ec5
tree3f2a9420839082cedb4be956506a9d2c7b0b5b63
parent1776cd33da528c878ef1fb5530f8ac788e445ee5
[BUGFIX] Reclaiming the memory allocated for static objects *is* necessary.

GiNaC allocates memory for static objects (i.e. flyweights, remember tables,
etc), but doesn't free it. This is OK if the program lifetime matches libginac
lifetime, since the OS will reclaim that memory anyway.
However, if the program lifetime is different from that of libginac, this
turns into a memory leak. This happens if someone dlopen's libginac.so, and
dlclose's it later on (read: if someone uses GiNaC via scripting language
bindings).

symbol::autoname_prefix(): there's no need for dynamical memory allocation.
remember_table::remember_tables(): likewise.
function::registered_functions(): likewise.
lib_init::~lib_init(): if library usage count drops to 0, reclaim the memory
                       allocated for flyweights.
ginac/function.pl
ginac/remember.cpp
ginac/symbol.cpp
ginac/utils.cpp