Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!brunix!man From: man@cs.brown.edu Newsgroups: comp.sys.mac.programmer Subject: How to indicate Out Of Memory Message-ID: <9866@brunix.UUCP> Date: 5 Jul 89 14:34:44 GMT Sender: news@brunix.UUCP Reply-To: man@cs.brown.edu () Organization: Brown University Department of Computer Science Lines: 18 I've written a program which allocates memory using NewHandle and SetHandleSize. I have my own routines UtilNewHandle and UtilSetHandleSize which call the toolbox routines and then check MemError() to see if the call succeeded. When I detect an out-of-memory condition, I'd like to put up an alert box and then abort. I have two problems: 1) It seems that I sometimes run crash with an out of memory before I get a chance to call MemError. 2) I crash when I try to put up an alert. I have tried to fix this by calling CouldAlert to make sure the resource IDs are in memory to begin with, and allocating a static block (with NewPtr) that is the size of a WindowRecord + 512 bytes, which I free immediately before calling Alert, so that it can create the window. Still no luck. Does anybody have any suggestions on how to handle this? --Mark