Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!oliveb!apple!jdevoto From: jdevoto@Apple.COM (Jeanne A. E. DeVoto) Newsgroups: comp.sys.mac.hypercard Subject: Re: Protection against memory limitation Message-ID: <28559@apple.Apple.COM> Date: 7 Apr 89 17:36:18 GMT References: <80078GFX@PSUVM> Organization: Apple Computer Inc, Cupertino, CA Lines: 20 In article <80078GFX@PSUVM> GFX@PSUVM.BITNET writes: >[...]when a script calls a paint tool for example, it will fail because there >is not enough memory left. > >Other than warning users that they need a full meg to use the stack, what >could be done to 1) exit gracefully from a script if there is not enough >memory to execute, 2) detect memory shortage before it creates any problem. There is an undocumented function "the heapSpace" that will return (approximately) the number of bytes remaining in the application heap. It's possible to do a little preflighting with this function to see whether you are dangerously low on memory before doing a memory- intensive operation. As I mentioned, the function is undocumented and I don't know whether it will be supported in the future. However, it has been present on all versions of HyperCard so far. jeanne a. e. devoto jdevoto@apple.com