memory leak, struct bsim3v32SizeDependParam

This commit is contained in:
h_vogt 2011-12-30 19:20:57 +00:00
parent 7a2b51b485
commit 7d4802c369
8 changed files with 76 additions and 45 deletions

View File

@ -1,6 +1,7 @@
2011-12-30 Holger Vogt
* b4v5dest.c, b4dest.c : memory leaks reduced
* b4v5dest.c, b4dest.c, b3dest, b3v32.dest : memory leaks reduced
* b3v32... : struct bsim3SizeDependParam --> struct bsim3v32SizeDependParam
2011-12-30 Robert Larice
* inpcom.c :
cleanup, drop `s_lower'

View File

@ -3,7 +3,7 @@
/**********
* Copyright 2004 Regents of the University of California. All rights reserved.
* File: b3dest.c of BSIM3v3.3.0
* Author: 1995 Min-Chie Jeng and Mansun Chan.
* Author: 1995 Min-Chie Jeng and Mansun Chan.
* Author: 1997-1999 Weidong Liu.
* Author: 2001 Xuemei Xi
**********/
@ -14,25 +14,43 @@
void
BSIM3destroy(
GENmodel **inModel)
GENmodel **inModel)
{
BSIM3model **model = (BSIM3model**)inModel;
BSIM3instance *here;
BSIM3instance *prev = NULL;
BSIM3model *mod = *model;
BSIM3model *oldmod = NULL;
BSIM3model **model = (BSIM3model**)inModel;
BSIM3instance *here;
BSIM3instance *prev = NULL;
BSIM3model *mod = *model;
BSIM3model *oldmod = NULL;
for (; mod ; mod = mod->BSIM3nextModel)
{ if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for (here = mod->BSIM3instances; here; here = here->BSIM3nextInstance)
{ if(prev) FREE(prev);
prev = here;
}
if(prev) FREE(prev);
for (; mod ; mod = mod->BSIM3nextModel) {
/** added to get rid of link list pSizeDependParamKnot **/
struct bsim3SizeDependParam *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->BSIM3instances; here; here = here->BSIM3nextInstance) {
if(prev) FREE(prev);
prev = here;
}
if(prev) FREE(prev);
}
if(oldmod) {
#ifdef USE_OMP3
/* free just once for all models */
FREE(oldmod->BSIM3InstanceArray);
#endif
FREE(oldmod);
}
if(oldmod) FREE(oldmod);
*model = NULL;
return;
}

View File

@ -22,7 +22,7 @@
int
BSIM3v32checkModel (BSIM3v32model *model, BSIM3v32instance *here, CKTcircuit *ckt)
{
struct bsim3SizeDependParam *pParam;
struct bsim3v32SizeDependParam *pParam;
int Fatal_Flag = 0;
FILE *fplog;

View File

@ -3,7 +3,7 @@
/**********
* Copyright 2001 Regents of the University of California. All rights reserved.
* File: b3dest.c of BSIM3v3.2.4
* Author: 1995 Min-Chie Jeng and Mansun Chan.
* Author: 1995 Min-Chie Jeng and Mansun Chan.
* Author: 1997-1999 Weidong Liu.
* Author: 2001 Xuemei Xi
* Modified by Paolo Nenzi 2002
@ -16,21 +16,33 @@
void
BSIM3v32destroy (GENmodel **inModel)
{
BSIM3v32model **model = (BSIM3v32model**)inModel;
BSIM3v32instance *here;
BSIM3v32instance *prev = NULL;
BSIM3v32model *mod = *model;
BSIM3v32model *oldmod = NULL;
BSIM3v32model **model = (BSIM3v32model**)inModel;
BSIM3v32instance *here;
BSIM3v32instance *prev = NULL;
BSIM3v32model *mod = *model;
BSIM3v32model *oldmod = NULL;
for (; mod ; mod = mod->BSIM3v32nextModel)
{ if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for (here = mod->BSIM3v32instances; here; here = here->BSIM3v32nextInstance)
{ if(prev) FREE(prev);
prev = here;
}
if(prev) FREE(prev);
for (; mod ; mod = mod->BSIM3v32nextModel) {
/** added to get rid of link list pSizeDependParamKnot **/
struct bsim3v32SizeDependParam *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->BSIM3v32instances; here; here = here->BSIM3v32nextInstance) {
if(prev) FREE(prev);
prev = here;
}
if(prev) FREE(prev);
}
if(oldmod) FREE(oldmod);
*model = NULL;

View File

@ -133,7 +133,7 @@ double dQsub0_dVd, dQsub0_dVb;
double m;
struct bsim3SizeDependParam *pParam;
struct bsim3v32SizeDependParam *pParam;
int ByPass, Check, ChargeComputationNeeded, error;
ScalingFactor = 1.0e-9;

View File

@ -65,7 +65,7 @@ static double
StrongInversionNoiseEvalNew(double Vds, BSIM3v32model *model,
BSIM3v32instance *here, double freq, double temp)
{
struct bsim3SizeDependParam *pParam;
struct bsim3v32SizeDependParam *pParam;
double cd, esat, DelClm, EffFreq, N0, Nl;
double T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, Ssi;
@ -111,7 +111,7 @@ static double
StrongInversionNoiseEvalOld(double vgs, double vds, BSIM3v32model *model,
BSIM3v32instance *here, double freq, double temp)
{
struct bsim3SizeDependParam *pParam;
struct bsim3v32SizeDependParam *pParam;
double cd, esat, DelClm, EffFreq, N0, Nl, Vgst;
double T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, Ssi;
@ -182,7 +182,7 @@ NOISEAN *job = (NOISEAN *) ckt->CKTcurJob;
BSIM3v32model *model = (BSIM3v32model *)inModel;
BSIM3v32instance *here;
struct bsim3SizeDependParam *pParam;
struct bsim3v32SizeDependParam *pParam;
char name[N_MXVLNTH];
double tempOnoise;
double tempInoise;

View File

@ -33,7 +33,7 @@ BSIM3v32temp (GENmodel *inModel, CKTcircuit *ckt)
{
BSIM3v32model *model = (BSIM3v32model*) inModel;
BSIM3v32instance *here;
struct bsim3SizeDependParam *pSizeDependParamKnot, *pLastKnot, *pParam=NULL;
struct bsim3v32SizeDependParam *pSizeDependParamKnot, *pLastKnot, *pParam=NULL;
double tmp, tmp1, tmp2, tmp3, Eg, Eg0, ni, T0, T1, T2, T3, T4, T5, Ldrn, Wdrn;
double delTemp, Temp, TRatio, Inv_L, Inv_W, Inv_LW, Vtm0, Tnom;
double Nvtm, SourceSatCurrent, DrainSatCurrent;
@ -231,7 +231,7 @@ int Size_Not_Found;
}
if (Size_Not_Found)
{ pParam = TMALLOC(struct bsim3SizeDependParam, 1);
{ pParam = TMALLOC(struct bsim3v32SizeDependParam, 1);
if (pLastKnot == NULL)
model->pSizeDependParamKnot = pParam;
else

View File

@ -117,7 +117,7 @@ typedef struct sBSIM3v32instance
double BSIM3v32Abulk;
double BSIM3v32AbovVgst2Vtm;
struct bsim3SizeDependParam *pParam;
struct bsim3v32SizeDependParam *pParam;
unsigned BSIM3v32lGiven :1;
unsigned BSIM3v32wGiven :1;
@ -213,7 +213,7 @@ typedef struct sBSIM3v32instance
} BSIM3v32instance ;
struct bsim3SizeDependParam
struct bsim3v32SizeDependParam
{
double Width;
double Length;
@ -347,7 +347,7 @@ struct bsim3SizeDependParam
double BSIM3v32k1ox;
double BSIM3v32k2ox;
struct bsim3SizeDependParam *pNext;
struct bsim3v32SizeDependParam *pNext;
};
@ -820,7 +820,7 @@ typedef struct sBSIM3v32model
double BSIM3v32af;
double BSIM3v32kf;
struct bsim3SizeDependParam *pSizeDependParamKnot;
struct bsim3v32SizeDependParam *pSizeDependParamKnot;
/* Flags */
unsigned BSIM3v32mobModGiven :1;