home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!darwin.sura.net!news.udel.edu!bach.udel.edu!kurisuto
- From: kurisuto@bach.udel.edu (Sean J. Crist)
- Subject: A few questions on this and that
- Message-ID: <By1vn3.Ctv@news.udel.edu>
- Sender: usenet@news.udel.edu
- Nntp-Posting-Host: bach.udel.edu
- Organization: University of Delaware
- Date: Sat, 21 Nov 1992 05:09:02 GMT
- Lines: 67
-
- Greetings all. The following questions probably don't warrant
- separate postings, so I'm putting them together into one.
- Questions 1-4 are probably answered in some obscure corner of
- IM, but I don't know where exactly to look.
-
- 1. If I'm *shrinking* a handle with SetHandleSize, I don't have
- to bother calling MemError, right? There's no possible way that
- shrinking a handle could could cause me to run out of memory,
- right? (Let's make the asumption that I know that the handle is
- valid going in.)
-
- 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)? Or is it a one-shot call which will give unreliable
- results the second time you call it? For example, I want to do this:
-
- AHandle := NewHandle(100);
- if MemError <> 0 then
- doOSErr(MemError); {A procedure I've defined}
-
- Is this OK, or do I have to do this:
-
- var Result : OSErr;
-
- AHandle := NewHandle(100);
- Result := MemError;
- if Result <> 0 then
- doOSErr(Result);
-
- 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?
-
- 4. Looking at my heap, I noticed that my DITL and DLOG resources
- were not being purged, even though the corresponding dialog had
- been dismissed. Sure enough, IM I-413 says 'GetNewDialog makes a
- copy of the item list and uses that copy.' Also, 'GetNewDialog
- doesn't release the memory occupied by the resources.' Well, poofle.
- Am I safe in marking these resources as purgeable in the file? In
- other words, once these resources have been read in by GetNewDialog,
- could they be purged before GetNewDialog has had a chance to make
- its copy of them? If this danger exists, does that mean I have to
- mark these resources as not purgeable and then call GetResource
- and ReleaseResource for the DITL and DLOG resources
- every time I'm finished with a dialog? (Please, no flames about
- using modal dialogs. :-)
-
- 5. Does there exist any kind of development tool which keeps track
- of how much space is free in your heap, and gives you an average
- and peak amount of how much space is allocated during the whole
- run of your application? Such a tool would be very useful in
- empirically determining how big the heap needs to be. 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, and it
- seems like someone somewhere would have written a tool to address
- this problem. (It would be especially nice if such a tool gave you
- a list of the top ten peaks of memory use, as well as the names of
- the routines where those peaks occurred). Does anything like this
- exist?
-
- Thank you much.
-
- --Kurisuto
-
-