extern FT_Int
ft_mem_debug_init( FT_Memory  memory )
{
    FT_MemTable  table;
    FT_Int       result = 0;


    if ( getenv( "FT2_DEBUG_MEMORY" ) )
    {
        table = ft_mem_table_new( memory );
        if ( table )
        {
            const char*  p;

            memory->user    = table;
            memory->alloc   = ft_mem_debug_alloc;
            memory->realloc = ft_mem_debug_realloc;
            memory->free    = ft_mem_debug_free;

            p = getenv( "FT2_ALLOC_TOTAL_MAX" );
            if ( p != NULL )
            {
                FT_Long   total_max = atol(p);

                if ( total_max > 0 )
                {
                    table->bound_total     = 1;
                    table->alloc_total_max = (FT_ULong) total_max;
                }
            }

            p = getenv( "FT2_ALLOC_COUNT_MAX" );
            if ( p != NULL )
            {
                FT_Long  total_count = atol(p);

                if ( total_count > 0 )
                {
                    table->bound_count     = 1;
                    table->alloc_count_max = (FT_ULong) total_count;
                }
            }

            result = 1;
        }
    }
    return result;
}
Beispiel #2
0
  extern FT_Int
  ft_mem_debug_init( FT_Memory  memory )
  {
    FT_MemTable  table;
    FT_Int       result = 0;


    if ( getenv( "FT_DEBUG_MEMORY" ) )
    {
      table = ft_mem_table_new( memory );
      if ( table )
      {
        memory->user    = table;
        memory->alloc   = ft_mem_debug_alloc;
        memory->realloc = ft_mem_debug_realloc;
        memory->free    = ft_mem_debug_free;
        result = 1;
      }
    }
    return result;
  }
Beispiel #3
0
  extern FT_Int
  ft_mem_debug_init( FT_Memory  memory )
  {
    FT_MemTable  table;
    FT_Int       result = 0;


    if ( ft_getenv( "FT2_DEBUG_MEMORY" ) )
    {
      table = ft_mem_table_new( memory );
      if ( table )
      {
        const char*  p;


        memory->user    = table;
        memory->alloc   = ft_mem_debug_alloc;
        memory->realloc = ft_mem_debug_realloc;
        memory->free    = ft_mem_debug_free;

        p = ft_getenv( "FT2_ALLOC_TOTAL_MAX" );
        if ( p )
        {
          FT_Long  total_max = ft_strtol( p, NULL, 10 );


          if ( total_max > 0 )
          {
            table->bound_total     = 1;
            table->alloc_total_max = total_max;
          }
        }

        p = ft_getenv( "FT2_ALLOC_COUNT_MAX" );
        if ( p )
        {
          FT_Long  total_count = ft_strtol( p, NULL, 10 );


          if ( total_count > 0 )
          {
            table->bound_count     = 1;
            table->alloc_count_max = total_count;
          }
        }

        p = ft_getenv( "FT2_KEEP_ALIVE" );
        if ( p )
        {
          FT_Long  keep_alive = ft_strtol( p, NULL, 10 );


          if ( keep_alive > 0 )
            table->keep_alive = 1;
        }

        result = 1;
      }
    }
    return result;
  }