home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!mcsun!sunic!kth.se!byse.nada.kth.se!d88-jwa
- From: d88-jwa@byse.nada.kth.se (Jon WΣtte)
- Subject: Re: TCL: Bizzare Behavior Time
- Message-ID: <1993Jan11.220137.26434@kth.se>
- Sender: usenet@kth.se (Usenet)
- Nntp-Posting-Host: byse.nada.kth.se
- Organization: Royal Institute of Technology, Stockholm, Sweden
- References: <1993Jan11.170231.17969@fsl.noaa.gov>
- Date: Mon, 11 Jan 1993 22:01:37 GMT
- Lines: 59
-
- In <1993Jan11.170231.17969@fsl.noaa.gov> urban@yoda.fsl.noaa.gov (Art Urban) writes:
-
- >Swatch reports that my application's heap has gone BAD BAD BAD BAD
- >(Swatch's words, not mine). I followed the source code until this condition
- >occured, and it happens right after a call to new ( anObject ). My TRY,
- >CATCH, ENDTRY doesn't blow up, so the call must've worked, yet my heap is
-
- Well, you might get memory movement, and then assign a
- member variable of an object that moves? Something like:
-
- class CFoo {
-
- CBar * theBar ;
-
- DoFoo ( ) ;
- } ;
-
-
- class CBar {
-
- IBar ( ) ;
-
- } ;
-
- CFoo :: DoFoo ( )
- {
- theBar = new CBar ;
- }
-
-
- The call to new is risky unless you have locked the
- object doing the call; try an intermediate temp variable:
-
- CFoo :: DoFoo ( )
- {
- CBar * aBar = new CBar ;
-
- theBar = aBar ;
- }
-
-
- Also, you might have already trashed the stack before that,
- and thus trashed the implicit "this" parameter. Or you
- might be executing in /referencing a disposed object.
-
- You _can_ trace "new" by adding the source for oops-library
- instead of the library (you have to fight to make it
- compile though)
-
- Try MacsBug Heap Scramble, and Step Spy on the stack
- right after the call to the function that calls new.
-
- Cheers,
-
- / h+
- --
- -- Jon W{tte, h+@nada.kth.se, Mac Hacker Deluxe --
- This signature is kept shorter than 4 lines in the interests of UseNet
- S/N ratio.
-