Mike Pontillo created ARROW-7553:
------------------------------------

             Summary: Unable to free all memory allocated when creating a 
GArrowSchema
                 Key: ARROW-7553
                 URL: https://issues.apache.org/jira/browse/ARROW-7553
             Project: Apache Arrow
          Issue Type: Bug
          Components: C, GLib
    Affects Versions: 0.15.1
         Environment: Ubuntu Focal with Linuxbrew packages installed
            Reporter: Mike Pontillo


I was not able to run the test code in [this 
gist|https://gist.github.com/mpontillo/cfbe7ebbf0b0f2acf31063512439bde7] (and 
corresponding [GitHub issue|https://github.com/apache/arrow/issues/6164]) 
without encountering a memory leak via {{garrow_schema_get_type_once}} 
(according to {{valgrind}}):

{code:java}
24 bytes in 1 blocks are possibly lost in loss record 192 of 486
   at 0x4A391AF: realloc (vg_replace_malloc.c:836)
   by 0x53B5D97: g_realloc (gmem.c:164)
   by 0x5128108: type_node_any_new_W (gtype.c:502)
   by 0x512D9EC: g_type_register_static (gtype.c:2766)
   by 0x512DDB4: g_type_register_static_simple (gtype.c:2719)
   by 0x4CB3CF8: garrow_schema_get_type_once (in 
/home/linuxbrew/.linuxbrew/Cellar/apache-arrow-glib/0.15.1_1/lib/libarrow-glib.so.15.0.1)
   by 0x4CB3E40: garrow_schema_get_type (in 
/home/linuxbrew/.linuxbrew/Cellar/apache-arrow-glib/0.15.1_1/lib/libarrow-glib.so.15.0.1)
   by 0x4CB4098: garrow_schema_new_raw(std::shared_ptr<arrow::Schema>*) (in 
/home/linuxbrew/.linuxbrew/Cellar/apache-arrow-glib/0.15.1_1/lib/libarrow-glib.so.15.0.1)
   by 0x4CB5860: garrow_schema_new (in 
/home/linuxbrew/.linuxbrew/Cellar/apache-arrow-glib/0.15.1_1/lib/libarrow-glib.so.15.0.1)
   by 0x401219: main (main.c:13)
{code}

I'm not positive if this is an actual bug in {{apache-arrow-glib}} or if my 
test code is incorrect, but I thought I would file an issue here (in addition 
to my question posted as a GitHub issue) for greater visibility.

It looks like the {{realloc}} call actually happens via {{glib}}; is this a 
one-time type registration that isn't expected to be cleaned up until the 
process exits? (I couldn't find a reference to {{garrow_schema_get_type_once}} 
in the {{arrow}} code.) I wanted to be certain, since I expect to use 
{{arrow-glib}} within a long-running process.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to