home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!spool.mu.edu!sol.ctr.columbia.edu!destroyer!gumby!kzoo!k044477
- From: k044477@hobbes.kzoo.edu (Jamie R. McCarthy)
- Subject: Re: A few questions on this and that
- Message-ID: <1992Nov21.144437.15863@hobbes.kzoo.edu>
- Organization: Kalamazoo College
- References: <By1vn3.Ctv@news.udel.edu>
- Date: Sat, 21 Nov 1992 14:44:37 GMT
- Lines: 55
-
- kurisuto@bach.udel.edu (Sean J. Crist) writes:
- >Greetings all.
-
- Hi!
-
- >1. If I'm *shrinking* a handle with SetHandleSize, I don't have
- >to bother calling MemError, right?
-
- I've always assumed this; if it could fail, I'd be _very_ surprised.
-
- >2. If I'm checking MemError, do the contents stay the same no
- >matter how many times I call it (i.e., until the next Memory
- >Manager call)?
-
- Yes. It just returns the value of the low-memory global MemErr.
-
- >3. IM warns that menus must not be purged, or a system error will
- >occur. However, said crash can only occur if somebody refers to
- >the deceased menu, right? If I purge a menu which I'm sure I don't
- >need any more, and then am careful not to refer to it again (in
- >the MenuBar or otherwise), I should be safe, right?
-
- Right. As long as the _toolbox_ doesn't know about it, it's just like
- any other resource, and you're safe.
-
- >5. Does there exist any kind of development tool which ...
- >...gives you an average
- >and peak amount of how much space is allocated during the whole
- >run of your application?
-
- No, but that _would_ be rather useful...
-
- >As it is now,
- >I have to figure out what point of the program is likely to have
- >the highest level of allocated memory and set a breakpoint there
- >to examine things. This takes a lot of guesswork and time...
-
- Time, but not guesswork, really. Put a _Debugger into your
- memory-reclaiming routine, so you'll get tipped off when it's called.
- Then set your app's heap to as low as you think it'll run under, and run
- it. If it gets called, check the stack crawl and you now know where
- you're in trouble--you might want to bump the app heap up a little to
- make sure you're near the "peak" point. If it doesn't get called,
- decrease size and try again.
-
- Then put _Debugger before and after the "peak" point, and when you hit
- the debugger, set breakpoints on the _NewHandle and _NewPtr traps, so
- you can watch what's going on.
-
- It does take time. But it's not hard to get a very clear picture of
- what your app's doing.
- --
- Jamie McCarthy Internet: k044477@kzoo.edu AppleLink: j.mccarthy
- "I don't think we should have to have them wandering the streets
- frightening women and people." - Pat Buchanan
-