Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
0.9.1
-
Fedora 20 64-bit on x86_64
-
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.)