[comp.windows.x.motif] Vanishing Server Resources with Motif1.0 Application

cliff@norisc.UUCP (Clifford Luke) (06/26/91)

Hello!

One of our clients has problems with an application which makes use of
many (>500) widgets.  So as not to use up too many server resources,
the customer is creating and destroying widgets when they are required
(the sacrifice in performance is acceptable).  Unfortunately the server
resources appear to be being gradually eaten up.  He is running Motif1.0
and an R3 based Server.  

There have been reports of "memory leaks" in earlier versions of Motif,
due to memory not being freed when widgets are destroyed, leading to
clients which "grow in size".

Has anybody observed similar problems on the server side caused by Motif 
not destroying widgets correctly (ie. server resources not being released)?  
If so will updating to Motif 1.1.2 alleviate these problems? 

ThanX
       Cliff
-- 
Name:  Cliff Luke
Phone: +49 911 895 3852
EMail: unido!estevax!norisc!cliff
Mail:  Siemens AG, AUT E543, Gleiwitzer Strasse 555, Nuernberg-M, W-Germany

richp@locus.com (Richard L. Pettit Jr.) (06/27/91)

Clifford Luke sez:
>                                                  He is running Motif1.0
>and an R3 based Server.
>
>There have been reports of "memory leaks" in earlier versions of Motif,
>due to memory not being freed when widgets are destroyed, leading to
>clients which "grow in size".
>
>Has anybody observed similar problems on the server side caused by Motif
>not destroying widgets correctly (ie. server resources not being released)?
>If so will updating to Motif 1.1.2 alleviate these problems?

There are 3 problems at work here (that I know of in Motif 1.0 & X11R3).

1) If backing store is on, server memory vanishes.
   Start the server with -bs to defeat this.

2) If Mwm*saveUnder is true you will be in deep poop in no time flat.
   Make it false.

3) If the memory allocator in the X server is first-fit not best-fit
   then uglyisms like this happen:

   p = Xalloc(7000000);  /* not enough memory, sbrk() */
   Xfree(p);             /* return to pool */
   q = Xalloc(1000);     /* 1000 < 7000000 use this chunk and leave 6999000 */
   p = Xalloc(7000000);  /* not enough memory, sbrk() */

Really, 3 is the big problem and 1 and 2 simply give the server copious
opportunity for it to happen.  Life with X has become correct since I
started the X -bs and Mwm*saveUnder: false gig.

There may also be a problem in XmStringFree() not freeing all of the
resources allocated by XmStringCreate*().  Scribble a test program that
spins in a loop allocating and freeing and see if the process grows.

Rich
-- 
----
              Richard Pettit                       Locus Computing Corp.
                                richp@locus.com
        "Opinions expressed herein are of the author, not (LCC or IBM)"