• Tim Peters's avatar
    _PyMalloc_{Malloc, Realloc}: Strive to meet the doc's promises about · 84c1b974
    Tim Peters authored
    what these do given a 0 size argument.  This is so that when pymalloc
    is enabled, we don't need to wrap pymalloc calls in goofy little
    routines special-casing 0.  Note that it's virtually impossible to meet
    the doc's promise that malloc(0) will never return NULL; this makes a
    best effort, but not an insane effort.  The code does promise that
    realloc(not-NULL, 0) will never return NULL (malloc(0) is much harder).
    
    _PyMalloc_Realloc:  Changed to take over all requests for 0 bytes, and
    rearranged to be a little quicker in expected cases.
    
    All over the place:  when resorting to the platform allocator, call
    free/malloc/realloc directly, without indirecting thru macros.  This
    should avoid needing a nightmarish pile of #ifdef-ery if PYMALLOC_DEBUG
    is changed so that pymalloc takes over all Py(Mem, Object} memory
    operations (which would add useful debugging info to PyMem_xyz
    allocations too).
    84c1b974
obmalloc.c 41.1 KB