[comp.windows.x] When to XmStringFree

brown@hpfcdq.HP.COM (John Brown) (10/23/90)

Here's a Motif 1.0 question . . .

I'm a bit confused about when it is appropriate to perform an XmStringFree()
on compound strings which have been used to specify widget resources via 
XtSetArg() and XtSetValues() calls.  I'm having particular trouble knowing
what to do with arrays of XmStrings used to create or change the contents of
an XmList widget.  I'm currently doing all the XmStringFree() calls I think
are appropriate, but my application data size still grows whenever I do the
following:

(Create array of XmStrings)
i = 0;
XtSetArg(wargs[i], XmNitems, string_list); i++;
XtSetArg(wargs[i], XmNitemCount, num_strings); i++;
XtSetArg(wargs[i], XmNselectedItemCount, 0); i++;
XtSetValues(w, wargs, i);
(XmStringFree each XmString in the array)

Do I need to somehow free the current XmNitems array in the list widget
before specifying a new one?  Or is that done automatically?  Please help!

Thanks in advance!

John Brown
HP Graphics Technology Division

nazgul@alphalpha.com (Kee Hinckley) (10/25/90)

In article <890048@hpfcdq.HP.COM> brown@hpfcdq.HP.COM (John Brown) writes:
>Here's a Motif 1.0 question . . .
>
>I'm a bit confused about when it is appropriate to perform an XmStringFree()
That's okay, so is Motif 1.0.  It's much more consistant (and documented)
in 1.1.

>an XmList widget.  I'm currently doing all the XmStringFree() calls I think
>are appropriate, but my application data size still grows whenever I do the
>following:
In Motif 1.0 your application data size will always grow.  1.0 leaked
like a sieve.  There's not much you can do about it other than get 1.1.

BTW.  This was probably better asked to comp.windows.x.motif.
-- 
Alphalpha Software, Inc.	|	motif-request@alphalpha.com
nazgul@alphalpha.com		|-----------------------------------
617/646-7703 (voice/fax)	|	Proline BBS: 617/641-3722

I'm not sure which upsets me more; that people are so unwilling to accept
responsibility for their own actions, or that they are so eager to regulate
everyone else's.