my gobject implementation



hi folks

I'm proud to announce my own implementation of the GLib/GType/GObject libraries. In fact it is one library called gsuite. I made it just for fun, also because i missed some features in the your implementation. The core is the GObject imlementation. It contains properties and signals for objects. It is all implemented on very few lines of code (I don't know how to measure it, there are some console commands like wc etc, but I don't know how to use them, anyway i would say not more than a few houndred lines of code only for the GType system) and I would say its much faster, not only because of the small size, but also because it doesn't use any locks and thus is not multi-thread safe (but adding locks for mt safety wouldn't be much work). The GValue implementation is in a separate library and doesn't depend on GType or GObject. There are some features missing (mainly in GType and GObject) which are in your implementation, but I think they are rarely used, so I didn't bother with them. The GLib library has only the glog facility and the trash stack (GTrashStack) implemented, just the minimum that is needed for GType and GObject. The feature I missed most was that I could only pass one argument to the signals, if you wants to pass two, you have to create a small structure with two pointers. In my library you can pass three arguments defined at signal creation and three user arguments, thats a total of total six arguments, that should be enough for all. Another problem was n_preallocs: Owen told me that it has no sense to set n_preallocs to a value greater than zero, I don't remember why, but I think it has something to do with the way the unused instances are saved (GMemChunk?). I have implemented it using the trash stack to store the unused instances, it worked even with n_preallocs set to more than 20000 and a instance size of a few kbytes, total use of memory exceeded 1Gig, everything was freed succesfully, no memory leak (proved with valgrind). Interfaces are implemented and supported, too, but not tested much, so there is some work to do if you wants to get them running properly.

And what now?
I don't know, perhaps someone wants my implementation, perhaps noone wants that. I will use it in my projects, thats sure. I had the idea to do something like a 'instance tracker' which would hold a pointer of each instance and free them automatically when the application ends, like a garbage collection.

anyway...

Anyone is kindly welcome to comment my work, if you do so, please cc me, I'm not subscribed to the list.

tc

--
wereHamster




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]