[ 
https://issues.apache.org/jira/browse/AVRO-549?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Douglas Creager updated AVRO-549:
---------------------------------

    Attachment: 0001-Custom-allocator-interface.patch

It didn't look like there had been much activity on this in awhile, so I took a 
stab at implementing a slightly different allocator API.  Instead of providing 
custom malloc, realloc, calloc, free, etc., you only have to provide a single 
function.  This is the same prototype that the Lua interpreter uses, and it 
seems to work pretty well.  The single function subsumes all of the standard 
ones; its prototype is:

  void *allocator(void *user_data, void *old_ptr, size_t old_size, size_t 
new_size);

For a malloc, old_ptr and old_size will be NULL/0.  For a free, new_size will 
be 0.  For a realloc, none of them will be NULL/0.

One additional nice feature of this API is that you have access to the 
allocated size during a free operation, which lets you plug in (for instance) 
glib's slice allocator.

All of the memory allocations in the library have been updated to use the 
custom allocator, and the test_avro_data test case has been updated to use an 
allocator that verifies that the library passes in the correct sizes when 
freeing stuff.

> Route memory management through an allocator interface
> ------------------------------------------------------
>
>                 Key: AVRO-549
>                 URL: https://issues.apache.org/jira/browse/AVRO-549
>             Project: Avro
>          Issue Type: New Feature
>          Components: c
>            Reporter: Bruce Mitchener
>            Assignee: Bruce Mitchener
>         Attachments: 0001-Custom-allocator-interface.patch, 
> avro_allocator.diff
>
>
> All memory management should go through an allocator interface that an app 
> can replace.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to