MAGIC Magic Mailing List
 
 

From: R. Timothy Edwards (tim AT stravinsky DOT jhuapl.edu)
Date: Wed Aug 28 2002 - 09:25:06 EDT

  • Next message: Daniel Garcia: "SUBSCRIBE"

    Dear Calin,
    
       I audited magic's memory usage and found that the largest part of
    the memory allocation comes from the techfile "extract" section.  The
    structure to hold extraction information is poorly designed and
    increases exponentially with TT_MAXTYPES.  The size of the structure
    is now 8.7MB, allocated as a single block.  The default "scmos.tech27"
    file declares 10 extraction styles, so the total is 87MB, even though
    two of the extract sections only contain one line!
    
       I'm going to rewrite the techfile reading code so that magic needs
    only to keep one extract section at a time.  The overhead for re-
    reading the tech file is minimal, and changing extraction styles is
    pretty rare, anyway.  The memory saved by doing so is 78MB.
    
       Also, the extraction information structure itself can be
    rearranged so that its size depends on the number of layer types
    defined, not on TT_MAXTYPES.  This will reduce the size even further.
    I have also redefined the CIF operation structure in the same way, so
    that the "bloat" distance information is allocated as needed rather
    than being declared a static array of TT_MAXTYPES which is often just
    filled with zeros.
    
       I would have thought that your magic-7.1 version would have used
    both the same value for TT_MAXTYPES and the same default scmos.tech27
    file, but the 8.7MB per tech style stands out as very obvious when I
    list all of the malloc() calls.  So at least one of the two must be
    different.  I added a couple of things to the ExtStyle structure in
    magic-7.2, making the memory usage somewhat worse, but not more than
    a few percent.
    
       Note that magic makes considerable use of the "TileTypeBitMask"
    type, which declares one bit per layer, so every time TT_MAXTYPES
    increases by 32, the TileTypeBitMask array requires another integer.
    There is not much that can be done about that increase.  On the
    other hand, structures in ExtStyle like "TileTypeBitMask ...
    [TT_MAXTYPES][TT_MAXTYPES]" increase in three dimensions whenever
    TT_MAXTYPES is increased, which is a ridiculous waste when most of
    the entries in the array are (typically) zero.
    
    					Regards,
    					Tim
    


  •  
     
    Questions? Contact Rajit Manohar
    cornell logo