Skip to content
  • David Barr's avatar
    Add memory pool library · 4709455d
    David Barr authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    Add a memory pool library implemented using C macros. The
    obj_pool_gen() macro creates a type-specific memory pool.
    
    The memory pool library is distinguished from the existing specialized
    allocators in alloc.c by using a contiguous block for all allocations.
    This means that on one hand, long-lived pointers have to be written as
    offsets, since the base address changes as the pool grows, but on the
    other hand, the entire pool can be easily written to the file system.
    This could allow the memory pool to persist between runs of an
    application.
    
    For the svn importer, such a facility is useful because each svn
    revision can copy trees and files from any previous revision.  The
    relevant information for all revisions has to persist somehow to
    support incremental runs.
    
    [rr: minor cleanups]
    [jn: added tests; removed file system backing for now]
    
    Signed-off-by: default avatarDavid Barr <david.barr@cordelta.com>
    Signed-off-by: default avatarRamkumar Ramachandra <artagnon@gmail.com>
    Signed-off-by: default avatarJonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    4709455d