Not logged in
Log in now
Create an account
Subscribe to LWN
An unexpected perf feature
LWN.net Weekly Edition for May 16, 2013
A look at the PyPy 2.0 release
PostgreSQL 9.3 beta: Federated databases and more
LWN.net Weekly Edition for May 9, 2013
ConnMan 1.0 released
Posted May 11, 2012 10:54 UTC (Fri) by jpw (guest, #84580)
Posted May 11, 2012 11:01 UTC (Fri) by alexl (subscriber, #19068)
Posted May 11, 2012 12:35 UTC (Fri) by nix (subscriber, #2304)
(Seriously. I like most of glib, though it is a bit memory-inefficient for some uses -- but gobject is a classic example of overgeneralization yielding a system that, while quite general, is terrifically difficult to use for almost all practical use cases. This is a fairly common trap to fall into, so I'm not *blaming* anyone, or I'd have to blame myself for several even more baroque systems I've perpetrated in the past which thankfully have not got into the wide world. But still.)
Posted May 12, 2012 21:25 UTC (Sat) by speedster1 (subscriber, #8143)
> (Seriously. I like most of glib, though it is a bit memory-inefficient for
> some uses -- but gobject is a classic example of overgeneralization
> yielding a system that, while quite general, is terrifically difficult to
> use for almost all practical use cases.)
Thanks, this is a much more civil explanation of the issue than I could manage at this point, with deadlines looming for producing a couple custom plugins for the heavily-glib-based gstreamer framework. Straight-forward generation of language bindings is a wonderful feature of glib, but coding in the glibc based C code itself... I'd better stop there, before I get uncivil
Posted May 17, 2012 19:38 UTC (Thu) by zlynx (subscriber, #2285)
Isn't gobject that abomination that contains 5 or 6 pointers to mostly useless information and causes any data structure that uses it to immediately bloat to over 100 MB in size?
5 64-bit pointers is 40 bytes before even including any information.
That is how I remember it anyway. I was trying to figure out how some new version of software went from 5 MB of resident set to over 100 MB back when my laptop had only 1 GB RAM.
Posted May 22, 2012 10:20 UTC (Tue) by jamesh (guest, #1159)
The other pointer can point to a GData structure that will be allocated if you use various GObject features (e.g. weak references).
I won't deny that it adds some memory overhead over a bare structure, but it is for features people generally use.
Posted May 22, 2012 16:04 UTC (Tue) by zlynx (subscriber, #2285)
Posted May 23, 2012 1:42 UTC (Wed) by jamesh (guest, #1159)
But the point is moot in the context of ConnMan: while they aren't using GObject, they are using glibs ADTs such as GSList.
Posted May 12, 2012 4:46 UTC (Sat) by cmccabe (guest, #60281)
Posted May 14, 2012 4:27 UTC (Mon) by johnny (guest, #10110)
I don't mean to be offensive or anything, I'm just curious. At one point, it used to be that C++ compilers were buggy and/or didn't produce goode enough code, but surely that's not true nowadays...?
Posted May 14, 2012 10:38 UTC (Mon) by gnb (subscriber, #5132)
Posted May 14, 2012 20:25 UTC (Mon) by cmccabe (guest, #60281)
C is a useful lowest-common-denominator language which can be accessed from anywhere. It also tends to be more efficient than the alternatives. That makes it useful for writing truly common libraries.
Now, having said that... I don't know whether C is the best language to write a network-manager-like program. I'm partial to wicd myself, which is written in Python. As long as the DBUS bindings can be accessed from any language, the choice of implementation language seems irrelevant.
And now it's time for a language flamewar, where all the usual points will be brought up exactly as usual. Move along, nothing to see here.
...and right they are
Posted May 12, 2012 17:57 UTC (Sat) by HelloWorld (guest, #56129)
Posted May 12, 2012 23:51 UTC (Sat) by nix (subscriber, #2304)
Posted May 14, 2012 8:00 UTC (Mon) by HelloWorld (guest, #56129)
Posted May 17, 2012 20:51 UTC (Thu) by nix (subscriber, #2304)
Posted May 17, 2012 22:01 UTC (Thu) by HelloWorld (guest, #56129)
Also, I think that ADTs in C invariably suck. It's simply not possible to write generic, type-safe ADTs in a sane way (the C preprocessor isn't sane).
Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds