Using the following thrift definition, compiler generates code that is leaking memory:
Since we use Enum element for the list, compiler uses GArray for that, like:
However, when reading the object from stream, it allocates memory for every element that it reads:
Although when clearing this element with g_array_unref, this does not free memory.
From Glib documentation we should set g_array_clear_func() if we want to free memory allocated for elements:
If array contents point to dynamically-allocated memory, they should be freed separately if free_seg is TRUE and no clear_func function has been set for array .
But I believe the best option would be just to read the elements into int and casting it to proper type, without allocating memory.