Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!snorkelwacker!bloom-beacon!viking.UUCP!dpb From: dpb@viking.UUCP (Don Bennett 433-3311, 408) Newsgroups: comp.windows.x Subject: Re: Motif XtDestroyWidget problem! Message-ID: <9005282211.AA10524@viking.frame.com> Date: 28 May 90 22:11:39 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 34 > XtDestroyWidget does not seem to work properly with Motif. For one thing > Motif uses amazing amounts of memory for widgets; create a bulletin > board with one button and 10 text widgets; you have used over 100K of memory > (in Ultrix)! What is even worse is that you cannot seem to free this space! > In a simple program where you create and destroy this set, each increment > causes a memory leak of 66K. Has anybody else encountered this problem? > The same problem occurs on Sparc's as well so it is not platform dependent. > XtUnrealizeWidget or even trying to destory each child widget does not solve > the problem. This makes the toolkit unusable in large applications. I have > a complicated window with over 100 widgets and it allocates 2M of memory > compared to DECwindows' 100K (at least DECwindows frees properly). Here is > the sample code (when you press the main button, it should create and free > a bulletin board): The problem is not in Motif, it is a bug in the R3 intrinsics. XtInstallAccelerators() merges the bulletin-board accelerators into the translations of each of its children, and this merged table is never freed. My fix was to: (a) clear the source widget in the action record, (b) cache the merged table, (c) record the source widget in an application context, (d) modify _XtTranslateEvent() to find the source widget in the application context if necessary; (e) Delete the context record when the destination widget is destroyed. I'll send you the fix I use if you drop me a line. No guarentees, but it works for me. Don Bennett (408)433-3311 dpb@frame.com Frame Technology