On Sat, May 18, 2013 at 11:41 AM, rastersoft <ras...@rastersoft.com> wrote:
> Hi all: > > How is the memory management in vala when using structs instead of > classes? I presume they are not ref-counted... > They aren't ref counted. Structs are value types, they are always either shallow copied or deep copied (depends on ownership). Beware the only difference is with nullable structs. Unfortunately the semantics there is a little different (it's a bug). Nullable structs are allocated on the heap and are not copied. > > The real questions are: > > * is it possible to use structs as elements in a Gee list without > running into memory management problems? > Yes, should be possible, int, double, etc. are vala structs. > * How to avoid them, in case there are such problems? Or so Imust use > true classes? > You can use classes that don't inherit from GObject, which are lighter. > * Can I use instead compact classes inside Gee lists adding them the > memory management decorator? > Compact classes are used for bindings, they aren't well supported when writing new vala code. > * In case the last answer is true, how are presented the compact classes > outside Vala? (for programs using gobject-introspection). Is it possible to > work with them from C? > As above, they're especially suited for bindings. Compact classes are usually non-ref counted. If it's not a struct and it's not a GTypeInstance, it's probably a compact class. -- www.debian.org - The Universal Operating System _______________________________________________ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list