[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

2234.0. "DwtLatin1String() question..." by BARREL::LEMMON () Thu Feb 08 1990 10:06

In one of the gobe examples there is a code segment that looks like

void routine_x()
{
   DwtCompString   title = DwtLatin1String("TITLE");
	.
	.
	main body
	.
	.
    XtFree(title);
}

It appears that the dwtlatin1string call is allocating space on the stack, hence
the xtfree is not necessary (or worse, shouldn't be done).  Is this the case?
Or is the XtFree required?

Thanks
/Jim

T.RTitleUserPersonal
Name
DateLines
2234.1QUARK::LIONELFree advice is worth every centThu Feb 08 1990 11:0810
The XtFree is required.  The storage for the compound string is allocated
from the heap.  (What made you think it came from the stack?)

What's more, you need to be careful when using operations such as
StrCat, because if you specify an existing compound string as the output,
the routine won't deallocate the old one before stomping on the pointer.
See the version of DECBURGER (in C, Ada or FORTRAN) in VMS V5.3 for
examples.

				Steve