plug a memory leak in bsim models

This commit is contained in:
dwarning 2018-08-28 14:42:29 +02:00
parent fa60f7d21d
commit 06fb917b82
12 changed files with 84 additions and 0 deletions

View File

@ -46,6 +46,13 @@ B2temp(GENmodel *inModel, CKTcircuit *ckt)
model->B2vgg2 = 2.0 * model->B2vgg;
model->B2vbb2 = 2.0 * model->B2vbb;
model->B2Vtm = 8.625e-5 * (model->B2temp + 273.0);
struct bsim2SizeDependParam *p = model->pSizeDependParamKnot;
while (p) {
struct bsim2SizeDependParam *next_p = p->pNext;
FREE(p);
p = next_p;
}
model->pSizeDependParamKnot = NULL;
pLastKnot = NULL;

View File

@ -50,6 +50,13 @@ int Size_Not_Found;
{ Temp = ckt->CKTtemp;
if (model->B3SOIDDGatesidewallJctPotential < 0.1)
model->B3SOIDDGatesidewallJctPotential = 0.1;
struct b3soiddSizeDependParam *p = model->pSizeDependParamKnot;
while (p) {
struct b3soiddSizeDependParam *next_p = p->pNext;
FREE(p);
p = next_p;
}
model->pSizeDependParamKnot = NULL;
pLastKnot = NULL;

View File

@ -49,6 +49,13 @@ int Size_Not_Found;
{ Temp = ckt->CKTtemp;
if (model->B3SOIFDGatesidewallJctPotential < 0.1)
model->B3SOIFDGatesidewallJctPotential = 0.1;
struct b3soifdSizeDependParam *p = model->pSizeDependParamKnot;
while (p) {
struct b3soifdSizeDependParam *next_p = p->pNext;
FREE(p);
p = next_p;
}
model->pSizeDependParamKnot = NULL;
pLastKnot = NULL;

View File

@ -68,6 +68,13 @@ double tmp3, T7;
{ Temp = ckt->CKTtemp;
if (model->B3SOIPDGatesidewallJctPotential < 0.1)
model->B3SOIPDGatesidewallJctPotential = 0.1;
struct b3soipdSizeDependParam *p = model->pSizeDependParamKnot;
while (p) {
struct b3soipdSizeDependParam *next_p = p->pNext;
FREE(p);
p = next_p;
}
model->pSizeDependParamKnot = NULL;
pLastKnot = NULL;

View File

@ -42,6 +42,13 @@ int Size_Not_Found;
model->BSIM3v0bulkJctPotential = 0.1;
if (model->BSIM3v0sidewallJctPotential < 0.1)
model->BSIM3v0sidewallJctPotential = 0.1;
struct bsim3v0SizeDependParam *p = model->pSizeDependParamKnot;
while (p) {
struct bsim3v0SizeDependParam *next_p = p->pNext;
FREE(p);
p = next_p;
}
model->pSizeDependParamKnot = NULL;
pLastKnot = NULL;

View File

@ -51,6 +51,13 @@ int Size_Not_Found;
model->BSIM3v1sidewallJctPotential = 0.1;
if (model->BSIM3v1GatesidewallJctPotential < 0.1)
model->BSIM3v1GatesidewallJctPotential = 0.1;
struct bsim3v1SizeDependParam *p = model->pSizeDependParamKnot;
while (p) {
struct bsim3v1SizeDependParam *next_p = p->pNext;
FREE(p);
p = next_p;
}
model->pSizeDependParamKnot = NULL;
pLastKnot = NULL;

View File

@ -55,6 +55,13 @@ int Size_Not_Found, error;
{ model->BSIM3v32GatesidewallJctPotential = 0.1;
fprintf(stderr, "Given pbswg is less than 0.1. Pbswg is set to 0.1.\n");
}
struct bsim3v32SizeDependParam *p = model->pSizeDependParamKnot;
while (p) {
struct bsim3v32SizeDependParam *next_p = p->pNext;
FREE(p);
p = next_p;
}
model->pSizeDependParamKnot = NULL;
pLastKnot = NULL;

View File

@ -220,6 +220,13 @@ int Size_Not_Found, i;
}
if (!model->BSIM4cgboGiven)
model->BSIM4cgbo = 2.0 * model->BSIM4dwc * model->BSIM4coxe;
struct bsim4SizeDependParam *p = model->pSizeDependParamKnot;
while (p) {
struct bsim4SizeDependParam *next_p = p->pNext;
FREE(p);
p = next_p;
}
model->pSizeDependParamKnot = NULL;
pLastKnot = NULL;

View File

@ -138,6 +138,13 @@ int Size_Not_Found, i;
}
if (!model->BSIM4v5cgboGiven)
model->BSIM4v5cgbo = 2.0 * model->BSIM4v5dwc * model->BSIM4v5coxe;
struct bsim4v5SizeDependParam *p = model->pSizeDependParamKnot;
while (p) {
struct bsim4v5SizeDependParam *next_p = p->pNext;
FREE(p);
p = next_p;
}
model->pSizeDependParamKnot = NULL;
pLastKnot = NULL;

View File

@ -163,6 +163,13 @@ int Size_Not_Found, i;
}
if (!model->BSIM4v6cgboGiven)
model->BSIM4v6cgbo = 2.0 * model->BSIM4v6dwc * model->BSIM4v6coxe;
struct bsim4v6SizeDependParam *p = model->pSizeDependParamKnot;
while (p) {
struct bsim4v6SizeDependParam *next_p = p->pNext;
FREE(p);
p = next_p;
}
model->pSizeDependParamKnot = NULL;
pLastKnot = NULL;

View File

@ -184,6 +184,13 @@ int Size_Not_Found, i;
}
if (!model->BSIM4v7cgboGiven)
model->BSIM4v7cgbo = 2.0 * model->BSIM4v7dwc * model->BSIM4v7coxe;
struct bsim4SizeDependParam *p = model->pSizeDependParamKnot;
while (p) {
struct bsim4SizeDependParam *next_p = p->pNext;
FREE(p);
p = next_p;
}
model->pSizeDependParamKnot = NULL;
pLastKnot = NULL;

View File

@ -89,6 +89,13 @@ B4SOItemp(
model->B4SOIGatesidewallJctSPotential = 0.1;
if (model->B4SOIGatesidewallJctDPotential < 0.1) /* v4.0 */
model->B4SOIGatesidewallJctDPotential = 0.1;
struct b4soiSizeDependParam *p = model->pSizeDependParamKnot;
while (p) {
struct b4soiSizeDependParam *next_p = p->pNext;
FREE(p);
p = next_p;
}
model->pSizeDependParamKnot = NULL;
pLastKnot = NULL;