Path: utzoo!attcan!uunet!cs.utexas.edu!usc!apple!sun-barr!newstop!sun!stpeter.Eng.Sun.COM!cmcmanis From: cmcmanis@stpeter.Eng.Sun.COM (Chuck McManis) Newsgroups: comp.sys.amiga.tech Subject: Re: rexxarplib Message-ID: <137062@sun.Eng.Sun.COM> Date: 11 Jun 90 19:24:45 GMT References: <1674@lpami.wimsey.bc.ca> <839@rulcvx.LeidenUniv.nl> Sender: news@sun.Eng.Sun.COM Organization: Sun Microsystems, Mt. View, Ca. Lines: 61 In article <839@rulcvx.LeidenUniv.nl> (W. Jaffe) writes: >I have an interesting problem. I wonder if it has any value >to check whether an AllocMem of 1Kb fails. >In my opinion it is an absolute waste of time and space to do >such a check, ... Consider that doing such a check in assembly language is two instructions (Test and branch) which takes very little time and very little space. > ,,, because the system would have crashed long before >only 1Kb was left. Intuition don't like a low memory environment. You have to think to yourself, "Is this a good thing?" (that Intuition doesn't like low memory) And the other thing you have to think about is "What if Intuition has already allocated all the memory it needs?" You see the reason you ask these two questions is simple. In the first case, it is clearly a bug that Intuition doesn't deal with low memory conditions. Given that, you can presume that Commodore will eventually fix it (possibly in 2.0 :-)). That would mean that now Intuition is merely grinding along with 768 bytes free and the user is getting the maximum possible use out of their system and suddenly _your_ program crashes the system because it didn't check to see if it really got the 1Kb it asked for. No don't you feel silly? And from the users perspective it will sound like "Gee, this stupid programmer couldn't spare 4 bytes and 11 machine cycles to see if is AllocMem() succeeded, instead he crashes my system!" They are not going to like you my friend. The second question deals more with the "rip-cord" effect of memory management. One way of "fixing" intuitions problems will be to give it its own memory pool to play with. That would mean the AllocMem results might fail when Intuition had all of the memory it needed. Again, for a few cycles, and even fewer bytes you've screwed the user by deciding not to check your results. >Also, it is absolute nonsense to check an OpenLibrary(graphics.library) >call. If it is not there, you can better go to a repair shop. >Of course, I like to know how others think about this subject. Nonsense? Isn't that a fairly strong word? What about trying to open Version 36 of the library and only version 34 is present? Eh? What happens when someone substitutes a disk based graphics.library on their system which has a custom video display system and you can't load it into memory ? Again, 4 bytes and 11 cycles. That's all we ask. When you hold these opinions you need to ask yourself, "Why would this occur, and if I ignore it what are the consequences?" Well on the Amiga the "Why" portion varies but the consequences are usually fatal. I would ask you "Why not?" it is easy to check these things and it makes your software much more reliable. Your reasons above don't outweigh the question of reliability. -- --Chuck McManis Sun Microsystems uucp: {anywhere}!sun!cmcmanis BIX: Internet: cmcmanis@Eng.Sun.COM These opinions are my own and no one elses, but you knew that didn't you. "I tell you this parrot is bleeding deceased!"