Path: utzoo!attcan!utgpu!watmath!watcgl!electro!ignac From: ignac@electro.UUCP (Ignac Kolenko) Newsgroups: comp.sys.atari.st Subject: Re: Communicating with Desk Accessories Message-ID: <510@electro.UUCP> Date: 15 Jun 89 00:48:07 GMT References: <8660@chinet.chi.il.us> <507@electro.UUCP> <1553@atari.UUCP> Reply-To: ignac@electro.UUCP (Ignac Kolenko) Organization: Electrohome Ltd., Kitchener, ON Lines: 62 In article <1553@atari.UUCP> kbad@atari.UUCP (Ken Badertscher) writes: >An AC_CLOSE message means that any resources that your accessory has >open are about to go away. Namely, any open files will be closed, >Malloc'ed memory will be released, etc. Anything that your accessory >sets up while a program is running has a potential for vanishing when >the program terminates. AC_CLOSE is the system's way of warning >accessories about programs terminating. lets say that my accessory requested memory before a program loads. what i mean is that my accessory gets memory while the normal system desktop is displayed. Malloc returns a pointer to the memory, and i go and use it for whatever i like. now, a program loads from the desktop. my accessory gets an AC_CLOSE message. does this mean that the memory i allocated above is not mine anymore??? if so, yikes!! :-( :-( if not, what happens in this case?????? >As far as memory-gobbling is concerned, this is unfortunately how the >system works. Whenever you switch resolutions, accessories get >re-loaded, and the old ones just hang around using memory. This is a >side effect of the way the AES treats res changes: not-quite- >a-warmboot. Offhand, I can't think of any quick and easy ways around >it. I usually use warmboots to switch resolution ;-). thats pretty weird. if i load a well behaved (or so i hope) accessory like the control panel (from atari) right from a cold boot, and search through memory using templmon for the text used in the menu_register() call, i can find only one reference to it. fine. there should only be one copy of it in memory at this time. now when i change resolutions, and search memory again for that same string pattern, i still only find one copy of it in memory. and i always assumed that that was the proper way for an accessory to work. (once i find that string in memory, a little bit of dissasembling in that area allows me to locate the main loop for the event dispatching, which i use as proof that there is only one copy in memory at this time) now when i load one of my accessories that i have written right from a cold boot, and search for the text for the menu_register call, i again find only one copy as i expected i would. now, if i change resolutions, and search again, i find TWO copies of the accessory in memory. and only on MY bloody accessories!!!!!!!!!! so, after all this rambling, i ask, is there any special clean up that i should do after getting a AC_CLOSE message. you mention things like memory get re-allocated, etc. should i always free memory at this time. should i close files that i had open, or will the system take care of that for me?? what other resources should i let go?? anyways, thanx for the info so far. it allows me to continue to "go where no atari programmer has gone before ..." (ok, so during midterms i get a bit melodramatic) :-) -- Ignac A. Kolenko (The Ig) watmath!watcgl!electro!ignac "Catholic or Protestant, you got no choice. I tried to scream, but I lost my voice!" from 'Irish Eyes Don't Smile Tonight' by SUBURBAN DISTORTION