• Tim Peters's avatar
    Lots of changes: · 92cebb71
    Tim Peters authored
    + A new scheme for determining whether an address belongs to a pymalloc
      arena.  This should be 100% reliable.  The poolp->pooladdr and
      poolp->magic members are gone.  A new poolp->arenaindex member takes
      their place.  Note that the pool header overhead doesn't actually
      shrink, though, since the header is padded to a multiple of 8 bytes.
    
    + _PyMalloc_Free and _PyMalloc_Realloc should now be safe to call for
      any legit address, whether obtained from a _PyMalloc function or from
      the system malloc/realloc.  It should even be safe to call
       _PyMalloc_Free when *not* holding the GIL, provided that the passed-in
      address was obtained from system malloc/realloc.  Since this is
      accomplished without any locks, you better believe the code is subtle.
      I hope it's sufficiently commented.
    
    + The above implies we don't need the new PyMalloc_{New, NewVar, Del}
      API anymore, and could switch back to PyObject_XXX without breaking
      existing code mixing PyObject_XXX with PyMem_{Del, DEL, Free, FREE}.
      Nothing is done here about that yet, and I'd like to see this new
      code exercised more first.
    
    + The small object threshhold is boosted to 256 (the max).  We should
      play with that some more, but the old 64 was way too small for 2.3.
    
    + Getting a new arena is now done via new function new_arena().
    
    + Removed some unused macros, and squashed out some macros that were
      used only once to define other macros.
    
    + Arenas are no longer linked together.  A new vector of arena base
      addresses had to be created anyway to make address classification
      bulletproof.
    
    + A lot of the patch size is an illusion:  given the way address
      classification works now, it was more convenient to switch the
      sense of the prime "if" tests in the realloc and free functions,
      so the "if" and "else" blocks got swapped.
    
    + Assorted minor code, comment and whitespace cleanup.
    
    Back to the Windows installer <wink>.
    92cebb71
obmalloc.c 31.2 KB