| T.R | Title | User | Personal Name
 | Date | Lines | 
|---|
| 888.1 | need more info | PSW::WINALSKI | Careful with that VAX, Eugene | Tue Jun 06 1989 17:15 | 7 | 
|  | That ought to work, although you don't need the char * type cast.  I think the
problem must be in the "Use s for whatever" code.  Can you give an example of
some of the "whatevers" that are causing trouble?  Do they involve any other
calls to compound string routines?
--PSW
 | 
| 888.2 | More Info | WJG::GUINEAU |  | Wed Jun 07 1989 06:43 | 47 | 
|  | 
Here's an example from the code:
void DWS_UpdateHumidity(char *hsb,char *hrb,char *hdb)
{
DwtCompString hs,hr,hd;
hs = DwtLatin1String(hsb);
hr = DwtLatin1String(hrb);
hd = DwtLatin1String(hdb);
SetLabel(cb_h_set,hs);
SetLabel(cb_h_act,hr);
SetLabel(cb_h_dev,hd);
XtFree((char *)hs);
XtFree((char *)hr);
XtFree((char *)hd);
}
hsb, hrb and hdb are all strings created by sprintf() and passed to this
function.
SetLabel is a macro:
#define SetLabel(w,t)           DWS_SetArg(W_list[(w)],DwtNlabel,(t))
and here is DWS_SetArg()
void DWS_SetArg(Widget w, char *resource, char *value)
{
Arg al[1];
XtSetArg(al[0], resource, value);
XtSetValues(w, al, 1);
}
 | 
| 888.3 | That part looks OK | PSW::WINALSKI | Careful with that VAX, Eugene | Wed Jun 07 1989 11:21 | 4 | 
|  | Please post the code for SetLabel.
--PSW
 | 
| 888.4 | SetLabel code | WJG::GUINEAU |  | Wed Jun 07 1989 17:03 | 23 | 
|  | 
It's a macro:
#define SetLabel(w,t)           DWS_SetArg(W_list[(w)],DwtNlabel,(t))
and here is DWS_SetArg()
void DWS_SetArg(Widget w, char *resource, char *value)
{
Arg al[1];
XtSetArg(al[0], resource, value);
XtSetValues(w, al, 1);
}
John
 | 
| 888.5 | it all looks OK to me | PSW::WINALSKI | Careful with that VAX, Eugene | Wed Jun 07 1989 17:35 | 5 | 
|  | Well, that's the way it's supposed to work, to the best of my knowledge.  It
doesn't look like your code is dropping any compound strings on the floor.
This sounds like a memory leak either in XtFree or in the label widget.  I
suggest QARing a simple complete example program that illustrates the problem.
 | 
| 888.6 | Sounds good | WJG::GUINEAU |  | Thu Jun 08 1989 17:38 | 4 | 
|  | 
Thanks Paul.
 | 
| 888.7 | More on memory leak | WJG::GUINEAU |  | Thu Jun 15 1989 12:09 | 33 | 
|  | 
I haven't had time to QAR this yet (been out of town), but today I did get
to isolate it. It's in the call to the SetLabel macro, which is as follows:
#define SetLabel(w,t)           DWS_SetArg(W_list[(w)],DwtNlabel,(t))
DWS_SetArg is this:
void DWS_SetArg(Widget w, char *resource, char *value)
{
Arg al[1];
XtSetArg(al[0], resource, value);
XtSetValues(w, al, 1);
}
The widget in question is a pushbutton (which I used because of it's 
nice look!. I don't use it [them] as a pushbutton, just a display
element to show the current values of a dynamic setpoint).
Anyway, it appears the widget is eating up memory for it's label name. 
I suspect that on every call to XtSetValues for the DwtNlabel, it simply
allocates more memory without freeing previously allocated "label name"
memory.  Could the pushbutton widget owner check on this?
I will QAR it when I get together a smaller program to demonstrate it.
I'm going to try switching to another widget (label?) to see what happens...
John
 | 
| 888.8 | label does the same | WJG::GUINEAU |  | Thu Jun 15 1989 13:07 | 9 | 
|  | 
I switched to using a label widget. Same results.
BTW - It sure is easy changing this kind of thing in UIL. Literally
changing all the appropriate "push_button" object names to "label"
and then adding one other resource value:  border_width = 2;
John
 | 
| 888.9 |  | WJG::GUINEAU |  | Thu Jun 15 1989 14:40 | 9 | 
|  | 
ALl right, so about the only work-around I can figure is to free the label
storage myself. 
Anyone have the struct definition for  a label widget?
John
 | 
| 888.10 | QAR # 02919  in DECwindows-IFT | WJG::GUINEAU |  | Fri Jun 16 1989 07:41 | 2 | 
|  | 
 |