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

Marvin Humphrey updated LUCY-35:
--------------------------------

    Attachment: Memory.c
                Memory.bp
                temp_hacks.diff

Lucy::Util::Memory introduces the following macros, which mimic the APIs of
their corresponding standard library functions:

  * MALLOCATE  -> malloc
  * CALLOCATE  -> calloc
  * REALLOCATE -> realloc
  * FREEMEM    -> free 

Using macros allows us the freedom to experiment with alternative memory
management schemes, such as substituting custom allocation libraries or
resolving to static inline functions.  The implementation in the Memory module
performs automatic error checking of return values, printing a message to
stderr and exiting if something surprising happens.  (It would be nice to
throw an Err, but we'd have to allocate one and that probably isn't going to
work so well if we're trying to signal that we're out of memory.) :)

> Wrap memory management functions
> --------------------------------
>
>                 Key: LUCY-35
>                 URL: https://issues.apache.org/jira/browse/LUCY-35
>             Project: Lucy
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Marvin Humphrey
>            Assignee: Marvin Humphrey
>            Priority: Minor
>         Attachments: Memory.bp, Memory.c, temp_hacks.diff
>
>
> Invoke malloc, calloc, realloc, and free via macros that resolve to wrapper
> functions.  Have the wrappers check the return value and throw OOM exceptions,
> so that we don't have to add error checking everywhere we perform memory
> allocation.

-- 
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