B�atrice,

ok if "nsString toto" is not required once you have recalled the Foo
function why not just make it a static variable that can be used every time
the function is called?

Foo(){
static nsString toto; // declared the first time you call foo, and then
re-used every time you call foo again.
toto.Assign(...);
}

Bert

"B�atrice Philippe" <netscape.public.mozilla.embedding> wrote in message
news:[EMAIL PROTECTED]
> what i do is :
>
> "Foo() {
> nsString toto;
> toto.Assign(....);
> .....
> //free(toto)  -> crashes
> //nsMemory::free(toto) -> crashes
> Foo();
> }"
>
> This is the kind of recursivity and use of nsString variable. So i don't
use
> the "new" allocator.
> if i intend to perform "free()" or "nsMemory::free()" before calling
Foo(),
> my application crashes.
> If i don't try anything to release my variables, because the recursivity
> allocates many times some variables, i have too much non released
variables.
>
> Thanks.
> -- 
> B�atrice Philippe
>
> [EMAIL PROTECTED]
> "Nicolas Weber" <[EMAIL PROTECTED]> a �crit dans le message de
> news:[EMAIL PROTECTED]
> > > How are you allocating them?  nsString is just a class.  If you
allocate
> > > an instance with operator new, then you will need to use operator free
> > > to destroy the instance.
> >
> > You intended to write "operator delete" instead of "operator free" (?).
> >
> > - Nico
>
>


_______________________________________________
mozilla-embedding mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-embedding

Reply via email to