Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!mcsun!ukc!acorn!ixi!ixi!pd From: pd@x.co.uk (Paul Davey) Newsgroups: comp.windows.x Subject: Re: HELP - XmStringCreateLtoR Message-ID: Date: 1 May 91 11:55:29 GMT References: <1991Apr29.192748.12558@hyper.hyper.com> Sender: paul@x.co.uk (Paul Davey) Organization: IXI Ltd. Lines: 41 In-Reply-To: walter's message of 29 Apr 91 19:27:48 GMT >>>>> On 29 Apr 91 19:27:48 GMT, walter (Walter Steinemann) said: Walter> I have the following in many places within my code: Walter> char msg[80]; Walter> XmString xmMessage; Walter> ... msg gets seto to some short string (20-30 bytes)... Is msg null terminated? Walter> xmMessage = XmStringCreateLtoR( msg, XmSTRING_DEFAULT_CHARSET ); Walter> I get the message "Error: Cannot perform malloc" (nothing else) and my Walter> application exits (no core file), but not always on the same call to Walter> XmStringCreateLtoR. My application code does not use this string, but Walter> I have found that this string is in libXt.a, in the Alloc.c section. Walter> I thought perhaps the Motif Library had some build in limit on the Walter> number of compound strings, so I inserted calls to XmStringFree for Walter> all my XmStringCreates - but the error still occurs. [BTW, when is it Walter> safe to do the free? ... after that SetArg or after the SetValues, or Walter> does it need to be done much later??] You can free after the XtSetValues if your not using the string again. Walter> Am I doing something wrong? Is something wrong with Motif or Xt? Walter> We have Motif 1.1.1 and IRIX 3.3.2 on a PI 4D/25. Well, it's clearly a memory problem somewhere. You should free XmStrings as soon as you have finished with them. Motif will not reuse the memory. Look out for any other toolkit allocated memory that you are not freeing. (eg the returned data from XmStringGetLtoR). -- Regards, pd@x.co.uk IXI Limited Paul Davey pd@ixi.uucp 62-74 Burleigh St. ...!uunet!ixi!pd Cambridge U.K. "These are interesting times" +44 223 462 131 CB1 1OJ USA: 1 800 XDESK 57