mouse@lightning.mcrcim.mcgill.EDU (02/27/91)
> Lately I have been wondering if there are any advantages to freeing > resources when you diconnect from the X server. I mean, before I > make a call to XCloseDisplay() I usually make calls to XFreeThis and > XFreeThat with a liberal dose of XDestroy all around. It makes it easier to lift your code and use it as part of something larger. As far as I can think of at the moment that's the only benefit. There is also an argument on the other side: just closing the display is quick compared to making slew of FreeFoo requests and *then* closing the display. I typically just exit() and forget about the XCloseDisplay(). About all it would buy me is the final XSync(), and I don't care about asynchronous errors 'cuz I'm going away anyway and wouldn't be around to report them! And I don't care about the final XFlush() 'cuz I'm dying on a received event and don't have anything to do except possibly draw in my own window, which is about to go away. > I know that the server will do all of this for me in most cases, All cases, unless you've set your close-down mode (XSetCloseDownMode) to RetainPermanent or RetainTemporary, in which case none of them are destroyed automatically. Modulo bugs, of course. Quoting from the protocol document: At connection close, [...]. If close-down mode (see SetCloseDownMode request) is RetainPermanent or RetainTemporary, then all resources [...] allocated by the client are marked as permanent or temporary, respectively [...]. If the mode is Destroy, all of the client's resources are destroyed. When a client's resources are destroyed, [...save-set processing...]. After save-set processing, all windows created by the client are destroyed. For each nonwindow resource created by the client, the appropriate Free request is performed. All colors and colormap entries allocated by the client are freed. der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu
harkcom@spinach.pa.yokogawa.co.jp (02/28/91)
This may be a stupid question, but... Lately I have been wondering if there are any advantages to freeing resources when you diconnect from the X server. I mean, before I make a call to XCloseDisplay() I usually make calls to XFreeThis and XFreeThat with a liberal dose of XDestroy all around. I know that the server will do all of this for me in most cases, but I've not bothered to figure out the difference. Are there any advantages in freeing and destroying or should I just start calling XCloseDisplay() by itself and let the server do the walking...? Are there cases where any memory allocated in the server for my client will be left over? Will there be any nasty little Asynchronous errors popping up?
harkcom@spinach.pa.yokogawa.co.jp (02/28/91)
In article <HARKCOM.91Feb27170212@spinach.pa.yokogawa.co.jp> harkcom@spinach.pa.yokogawa.co.jp writes: =} [A few questions about free] And also, Will there be any difference in X11R5 as far as the XIM and XIC stuff is concerned? BTW: When is R5 coming? I heard that it would be out in the first half of this year, but I've heard nothing since... Al