[comp.windows.x] Widget creation: slower and slower

Francois.Laagel@ec.bull.fr (07/12/90)

I just have written a very simple application using X11R3 X toolkit and the
Motif 1.0 widget set. This application has an XmForm as its main window and
contains 2 XmPushButtons. One of them has a callback routine registered for
the XmCR_ACTIVATE reason.

So when the user activates this pushButton the callback routine creates an
XmFormDialog (i.e. a DialogShell and an XmForm) and about 30 children
(XmLabelGadgets, XmTexts and XmPushButtons). The pushButtons are used -among
other things- to pop down the formDialog.

Although I could pop it down by unmanaging it, I wished to see what would
happen if I destroyed it. Doing so implies that the formDialog and its
children are created on user's request and destroyed when not needed anymore.

This experience showed a very strange phenomenon : the creation phase took
more and more time (6 seconds for the 1st time, 13 seconds for the 2nd time
then 18 seconds, finaly if took over a minute to create the form and its
children for the tenth time). The times given here were measured using the
libc clock() function.

I suspect that it has something to do with XtK memory allocation method. Can
anyone confirm this ? The Core destroy method of Motif widgets or
XtDestroyWidget could be guilty as well, if they did not free the memory they
asked for during widget creation.

                Francois Laagel

ben@hpcvlx.cv.hp.com (Benjamin Ellsworth) (07/13/90)

Is your code getting back to XtMainLoop (or an analog) in between the
creations and the destructions?

---

Ben