[comp.windows.x] Memory Deallocation of XtDestroyWidget?

gteo@swift.cs.tcd.ie (12/13/90)

Hello,
	I am looking into the memory usage by the Motif and Xt. What I did
was to load in some 100 push button widgets at run-time (invoked using Callback)
from a UID file, then destory these widgets on another press of a button.
However,the SZ and RSS have increased rather than decreased.
What have I done wrong? I thought the XtDestroyWidget is to destroy the
widget and free the memory. 

The size of the SZ and RSS are as follows:

	SZ	RSS
	1200	720	/* With Two  push buttons on screen */
	1280	820	/* Loaded another 98 push buttons to make 100 */
	2184	1728	/* After the 98 push buttons have been destroyed 
			   and the display is left with the initial 2 buttons */

Thanks in Advance

Ghee Teo
Trinity College,
Dublin 2,
Ireland.

kaleb@thyme.jpl.nasa.gov (Kaleb Keithley ) (12/14/90)

In article <1990Dec13.122714.7669@swift.cs.tcd.ie> gteo@swift.cs.tcd.ie writes:
>Hello,
>	I am looking into the memory usage by the Motif and Xt. What I did
>was to load in some 100 push button widgets at run-time (invoked using Callback)
>from a UID file, then destory these widgets on another press of a button.
>However,the SZ and RSS have increased rather than decreased.

Candidate for the FAQ?  What version of X?  Patched to what level?
What version of Motif?  What OS?  X11R3 and Motif 1.0 both have serious
memory leak problems.  X11R4 and Motif 1.1 have cured most of them,
but there are still some remaining.  Have you patched up to fix-18 on 
X11R4; serious leaks abound in XtDestroyWidget if you have not.

Finally, under any version of UNIX, you will *never* (never say never) see 
a process size get smaller.  That's just the way malloc is implemented.

-- 
Kaleb Keithley                      Jet Propulsion Labs
kaleb@thyme.jpl.nasa.gov

Offensive quote coming soon to a .signature file near you.

CS727713%HKPCC.HKP.HK@MITVMA.MIT.EDU ("Stephen Wong ", Hong Kong Poly. - Computing Dept.) (12/15/90)

>Hello,
>        I am looking into the memory usage by the Motif and Xt. What I did
>was to load in some 100 push button widgets at run-time (invoked using Callback
   )
>from a UID file, then destory these widgets on another press of a button.
>However,the SZ and RSS have increased rather than decreased.
>What have I done wrong? I thought the XtDestroyWidget is to destroy the
>widget and free the memory.

This kind of behaviour is normal in Unix world.  Most (or all) implementations
or malloc, which Xt calls, can grab memory from the system pool, but after
that, it cannot release the memory back to the pool.  What malloc does, is
still reserving the freed memory for future malloc use.  And that's why you
can't see your memory usage decrease.

Later release of Unix may consider to let free function to return memory to
system pool.

Regards,
Stephen Wong.
(Internet:cs727713@hkpcc.hkp.hk)