Path: utzoo!utgpu!watserv1!watmath!att!att!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!usc!elroy.jpl.nasa.gov!thyme!kaleb From: kaleb@thyme.jpl.nasa.gov (Kaleb Keithley ) Newsgroups: comp.windows.x Subject: Re: GC: how many is too many? Message-ID: <1990Nov29.033116.1355@thyme.jpl.nasa.gov> Date: 29 Nov 90 03:31:16 GMT References: <4509@titan.sw.mcc.com> <1990Nov28.222839.498@thyme.jpl.nasa.gov> <2933@gazette.bcm.tmc.edu> Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 60 In article <2933@gazette.bcm.tmc.edu> etaylor@wilkins.iaims.bcm.tmc.edu (Eric Taylor) writes: > >| kaleb@thyme.jpl.nasa.gov (That's me) wrote: >|> Toolkits such as Motif may have as many as a dozen GCs per widget; >|> top shadow color, bottom shadow color, default font, foreground color, >|> background color, etc. Multiply by the number of Widgets in a "typical" >|> application; ours have > one hundred, then multiply by the number of >|> applications running; two or three dozen. >|> > >This is only partly True. Widgets using XtGetGC share >their GC's. You might be suprised to find out there are probably less than a couple dozen per application >using XtGetGC (I am assuming that the MOTIF widget >set uses XtGetGC). >-- Only partially right. Having just traced through widget creation in searching for a memory leak, I felt marginally qualified to answer the original question. I went back and verified. An XmForm has four GCs, each different: e.g. background_GC = 0x15b8c0 highlight_GC = 0x15bba8 top_shadow_GC = 0x15b9b8 bottom_shadow_GC = 0x15bab0 True, most widgets share share these GCs. Additional Widget types add additional unique GCs. e.g. XmPushButton has the following additional GCs: normal_GC = 0x15e6e8 insensitive_GC = 0x15e948 and: fill_gc = 0x15f400 background_gc = 0x15f4f8 These four appear to be shared among all pushbuttons. I could go on ad nauseum about each widget type and its corresonding unique GCs that it has but I won't. It wouldn't take much, using the various Motif Widgets to reach a good sized number of GCs. Add to that an environment such as ours which features a combination of of applications using Xaw, Motif, Homegrown, and possibly OpenLook, each adding to the score of GCs. On the client side, the number of GCs would be limited to system RAM, and available swap space. Since GCs aren't really that big, you could probably get a lot of them. All this of course dodges the issue of server side GCs. If I can make presumptions based on the level of cacheing elsewhere in X, it may be safe to say that the server caches like GCs, such that many instances of the same application would result in only one of each type is made by the server. It would be interesting to hear from someone in the consortium any thoughts they might have on the topic. Anyone care to comment? -- Kaleb Keithley Jet Propulsion Labs kaleb@thyme.jpl.nasa.gov Good girls get to go to heaven, but bad girls get to go everywhere!