[comp.windows.x.motif] Memory Leaks

cynde@tyr.css.gov (Cynde Smith) (04/24/91)

We have a large application program running X and Motif that
appears to have consistent 'memory leaks' under certain conditions.
An example of a condition is the building of a popup-shell and 
several associated child widgets, and immediately popping it
down with a 'done' button which invokes XtDestroyWidget() on the
popup.  After cleaning up some of the leaks by explicitly freeing 
all resources created with XmStringCreate() we're still losing 
~6K on each popup/popdown.  It's never exactly the same amount.

Has anyone experienced something similar before ?  Our guess is  
we may be overlooking a resource or environment setting.

lynnes@ALEX.CSS.GOV (Christopher Lynnes) (04/24/91)

>We have a large application program running X and Motif that
>appears to have consistent 'memory leaks' under certain conditions.
>An example of a condition is the building of a popup-shell and 
>several associated child widgets, and immediately popping it
>down with a 'done' button which invokes XtDestroyWidget() on the
>popup.  

People have reported memory leak problems with shell creation/destruction, 
though most of these complaints seemed to be for the X11/R3-Motif 1.0
combination. One way to remedy that is to create a single popup, and
manage and unmanage it (changing its resources/children appropriately),
which also saves time.

Chris Lynnes                                ===== : = :::::
Teledyne Geotech                           ===== :: == :::::
Alexandria, Virginia                            ::: ===
(703) 739-7316                                  ::   ==
lynnes@seismo.CSS.GOV                           :     =

rob@pcad.UUCP (Ralph Brown) (04/24/91)

In article <692@esosun.UUCP>, cynde@tyr.css.gov (Cynde Smith) writes:
> We have a large application program running X and Motif that
> appears to have consistent 'memory leaks' under certain conditions.
> An example of a condition is the building of a popup-shell and 
> several associated child widgets, and immediately popping it
> down with a 'done' button which invokes XtDestroyWidget() on the
> popup.  After cleaning up some of the leaks by explicitly freeing 
> all resources created with XmStringCreate() we're still losing 
> ~6K on each popup/popdown.  It's never exactly the same amount.
> 
> Has anyone experienced something similar before ?  Our guess is  
> we may be overlooking a resource or environment setting.


We've had the same problem in this and other cases of creating and
destroying widgets on the fly. I believe this is a real bug in X.

We got around it by keeping a library of menus and entries and managing
them as needed. If a new one is used, it is created and kept around.
Needless to say you need to keep some sort of indexing scheme so you can
find out if you've got and entry you want.

Ralph