Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#20 Add a way to override allocation functions.

closed
nobody
None
5
2007-11-25
2007-11-21
Nick Mathewson
No

Many libraries allow the user to pass in replacements for malloc(), free(), and realloc(). This helps the user debug memory allocation, and use special-purpose allocators as needed.

Discussion

  • Nick Mathewson
    Nick Mathewson
    2007-11-25

    Logged In: YES
    user_id=499
    Originator: YES

    I've done a patch for this. Instead of using malloc(), free(), realloc(), calloc(), and strdup(), libevent now uses event_malloc(), event_free(), and so on. By default, these are the same as the stdc versions, but the library user can override them by calling event_sent_mem_functions and passing in a malloc/realloc/free tuple.

    I'll probably commit this tomorrow if there are no objections.

    (I'd attach the patch, but sourceforge is being funny.)

     
  • Niels Provos
    Niels Provos
    2007-11-25

    Logged In: YES
    user_id=245089
    Originator: NO

    Sounds great to me. Thanks.

     
  • Nick Mathewson
    Nick Mathewson
    2007-11-25

    • status: open --> closed
     
  • Nick Mathewson
    Nick Mathewson
    2007-11-25

    Logged In: YES
    user_id=499
    Originator: YES

    Committed to trunk; thanks!