Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!sdd.hp.com!hplabs!hplabsz!mayer From: mayer@hplabsz.HPL.HP.COM (Niels Mayer) Newsgroups: comp.windows.x.motif Subject: Re: XmLabel question Message-ID: <5875@hplabsz.HPL.HP.COM> Date: 2 Sep 90 00:36:49 GMT References: <118526@linus.mitre.org> <141712@sun.Eng.Sun.COM> Reply-To: mayer@hplabs.hp.com (Niels Mayer) Organization: Hewlett-Packard Labs, Software & Systems Lab, Palo Alto, CA. Lines: 55 Summary: Expires: Sender: Followup-To: In article <141712@sun.Eng.Sun.COM> argv@turnpike.Eng.Sun.COM (Dan Heller) writes: >Another thing to consider is the fact that to hard-code the label, you have >to create a compound string (which allocates memory) and then free it. >If you are doing this for hundreds of labels (which isn't uncommon), >then you're going to fragment your heap space pretty quickly and lower >your performance ratio. > >Footnote: Probably a good enhancement for Motif 1.1.1 would be a routine >that created and returned a pointer to a compound string that was stored >in static space. Each call would overwrite the contents of the previous >call -- that way, you can use strings that are temporary all over the >place without all that overhead of allocating and deallocating memory. This has been my feeling about the Xtoolkit in general, and the problem becomes ridiculous with compound strings. Such memory usage could be done in a number of places throughout Motif. There's more than just compound strings that get gratuitously copied and freed every time you do anything. I'd like to even go so far as to have the Toolkit not create a copy of every resource passed in from the user's space; rather, it should take the user's object, and do whatever the hell it pleases with it, freeing it when it is done with it (unless it was statically allocated). If you are planning on doing something with data that you passed in to Motif, then make a copy of it for yourself! Afterall, this is programming in C where you are supposed to understand and worry about memory management yourself. If you want to be a pinko-commie and program in Lisp or some other wussy garbage collected language, then do it in Lisp. :-) The way things are now with Xt/Motif programming, you get all the pain and tedium of programming in C, and all the efficiency of Lisp. We should be striving for the opposite. Note that I have nothing against Lisp -- afterall, my WINTERP rapid prototyping and extension language is based on a small Lisp interpreter (XLISP) that is implemented in C. When I'm writing application-UI code, I am a Lisp pinko-commie about 99% of the time. When I write in C, I expect to program like a ruthless-capitalist -- laissez-faire -- too bad about the poor lazy proletariate that can't figure out how to manage their own memory (nothing like stretching an analogy to the point of stupidity :-) Another enhancement would be to throw out Motif's XmStrings and allow good ol' fashioned normal null-terminated char strings to be used by default. Using Compound strings, or 16byte-char-strings should be something that can be done optionally, by either a runtime global resource switch, or compile-time option, or perhaps both. Although I guess having strings that go left-to-right roman and right-to-left arabic within the same widgit will be useful when the OSF its Oil Company conspirators annex Iraq. :-( ------------------------------------------------------------------------------- Niels Mayer -- hplabs!mayer -- mayer@hplabs.hp.com "Founding member, UIL and XmString Haters International" THESE OPINIONS ARE PERSONAL, I AM NOT SPEAKING FOR: Human-Computer Interaction Department Hewlett-Packard Laboratories Palo Alto, CA. *