Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-2684

c_glib: Improvements to map deserialization in generated code

    XMLWordPrintableJSON

Details

    • Patch Available

    Description

      The attached patch to the compiler improves memory management in generated code relating to the deserialization of maps (implemented using hash tables in c_glib). It makes three changes:

      1. Newly created hash tables are constructed with references to the correct hashing, comparison and deallocation functions, as determined by the types they hold.

      2. Base types allocated on the heap will be automatically deallocated with the g_free function (instead of not being deallocated at all!).

      3. The direct-comparison function is now explicitly specified for enumerated types, which are (somewhat dubiously) always stored within a pointer value instead of on the heap.

      (No test case for these changes either, mostly as I'm unsure how I'd write one. Again the integration test serves as a pretty rigorous test of this code, though it completes with or without this patch applied.)

      Attachments

        Activity

          People

            simonsouth Simon South
            simonsouth Simon South
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: