Browse Source

reduce memory leaks for run - reset

h_vogt 14 years ago
parent
commit
127213bff0
  1. 5
      ChangeLog
  2. 52
      src/spicelib/devices/bsim4v6/b4v6dest.c

5
ChangeLog

@ -1,3 +1,8 @@
2011-12-29 Holger Vogt
* b4v6dest.c : improved removal of circuit installation,
bug no. 3229770. Memory leaks are quasi gone for
10 run - reset sequences of a 1000 transistor circuit
2011-12-29 Robert Larice
* src/include/ngspice/Makefile.am :
install headers in $(pkdatadir)/include/ngspice

52
src/spicelib/devices/bsim4v6/b4v6dest.c

@ -16,25 +16,45 @@
void
BSIM4v6destroy(
GENmodel **inModel)
GENmodel **inModel)
{
BSIM4v6model **model = (BSIM4v6model**)inModel;
BSIM4v6instance *here;
BSIM4v6instance *prev = NULL;
BSIM4v6model *mod = *model;
BSIM4v6model *oldmod = NULL;
BSIM4v6model **model = (BSIM4v6model**)inModel;
BSIM4v6instance *here;
BSIM4v6instance *prev = NULL;
BSIM4v6model *mod = *model;
BSIM4v6model *oldmod = NULL;
for (; mod ; mod = mod->BSIM4v6nextModel)
{ if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for (here = mod->BSIM4v6instances; here; here = here->BSIM4v6nextInstance)
{ if(prev) FREE(prev);
prev = here;
}
if(prev) FREE(prev);
for (; mod ; mod = mod->BSIM4v6nextModel) {
/** added to get rid of link list pSizeDependParamKnot **/
struct bsim4v6SizeDependParam *pParam, *pParamOld=NULL;
pParam = mod->pSizeDependParamKnot;
for (; pParam ; pParam = pParam->pNext) {
FREE(pParamOld);
pParamOld = pParam;
}
FREE(pParamOld);
pParam = NULL;
/** end of extra code **/
if(oldmod)
FREE(oldmod);
oldmod = mod;
prev = NULL;
for (here = mod->BSIM4v6instances; here; here = here->BSIM4v6nextInstance) {
if(prev) FREE(prev);
prev = here;
}
if(prev) FREE(prev);
}
if(oldmod) {
#ifdef USE_OMP4
/* free just once for all models */
FREE(oldmod->BSIM4v6InstanceArray);
#endif
FREE(oldmod);
}
if(oldmod) FREE(oldmod);
*model = NULL;
return;
}
Loading…
Cancel
Save