[Project_owners] clearing variables

Konstantin Svist fry.kun at gmail.com
Mon Feb 6 20:36:16 EST 2006


eeeww!
circular references are pain in the ass for garbage collectors...
if that's your case, then something like this may work

var tmp = {};
for (i in o) {
 tmp[i] = o[i];
}
delete o;
for (i in tmp) {
 wipe(tmp[i]);
}

On 2/6/06, Adam Judson <adamsplugins at gmail.com> wrote:
> Any chance o[i][j][k] == o?
>
> That always seems to happen to me...
>
> A
>
>
> On 06/02/06, Eric H. Jung <grimholtz at yahoo.com> wrote:
> > With your comments in mind, I've written this function:
> >
> > var PwdMkr_MPW = {
> >
> >   // Recursively delete sensitive data
> >   wipe : function(o) {
> >     if (o) {
> >       for (var i in o)
> >         this.wipe(o[i]);
> >       delete o;
> >     }
> >   },
> >   ...
> > };
> >
> > Often when I call this function (not always) I get: "Error: too much
> > recursion". I realize this might be a Computer Science 101 question,
> > but do you see anything wrong with my function?
> >
> > Thank you,
> > Eric
> >
> >
> > --- Konstantin Svist <fry.kun at gmail.com> wrote:
> >
> > > You know, I also thought it should cause an exception, but I tried it
> > > in my browser (Fx 1.5.0.1) and it gives me false.
> > > I guess it varies with implementation or depends on garbage
> > > collection
> > > or something like that.
> > > the reason i didn't write '"foo" in this' was because I was trying to
> > > generate an exception in the first place
> > > I'm pretty sure I've seen it throw one a long time ago.. maybe it was
> > > in IE..
> > >
> > >
> > > On 2/6/06, Neil <neil at parkwaycc.co.uk> wrote:
> > > > Eric H. Jung wrote:
> > > >
> > > > >By the way, 'foo in this' after 'delete foo' yields
> > > 'ReferenceError: foo is not defined', not false.
> > > > >
> > > > I think he meant '"foo" in this'.
> > > > _______________________________________________
> > > > Project_owners mailing list
> > > > Project_owners at mozdev.org
> > > > http://mozdev.org/mailman/listinfo/project_owners
> > > >
> > > _______________________________________________
> > > Project_owners mailing list
> > > Project_owners at mozdev.org
> > > http://mozdev.org/mailman/listinfo/project_owners
> > >
> >
> > _______________________________________________
> > Project_owners mailing list
> > Project_owners at mozdev.org
> > http://mozdev.org/mailman/listinfo/project_owners
> >
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners
>


More information about the Project_owners mailing list