921 |
} |
} |
922 |
|
|
923 |
|
|
924 |
|
static int |
925 |
|
ft_mem_source_compare( const void* p1, |
926 |
|
const void* p2 ) |
927 |
|
{ |
928 |
|
FT_MemSource s1 = *(FT_MemSource*)p1; |
929 |
|
FT_MemSource s2 = *(FT_MemSource*)p2; |
930 |
|
|
931 |
|
if ( s2->max_size > s1->max_size ) |
932 |
|
return 1; |
933 |
|
else if ( s2->max_size < s1->max_size ) |
934 |
|
return -1; |
935 |
|
else |
936 |
|
return 0; |
937 |
|
} |
938 |
|
|
939 |
|
|
940 |
extern void |
extern void |
941 |
FT_DumpMemory( FT_Memory memory ) |
FT_DumpMemory( FT_Memory memory ) |
942 |
{ |
{ |
947 |
{ |
{ |
948 |
FT_MemSource* bucket = table->sources; |
FT_MemSource* bucket = table->sources; |
949 |
FT_MemSource* limit = bucket + FT_MEM_SOURCE_BUCKETS; |
FT_MemSource* limit = bucket + FT_MEM_SOURCE_BUCKETS; |
950 |
|
FT_MemSource* sources; |
951 |
|
FT_UInt nn, count; |
952 |
const char* fmt; |
const char* fmt; |
953 |
|
|
954 |
|
count = 0; |
955 |
|
for ( ; bucket < limit; bucket++ ) |
956 |
|
{ |
957 |
|
FT_MemSource source = *bucket; |
958 |
|
|
959 |
|
for ( ; source; source = source->link ) |
960 |
|
count++; |
961 |
|
} |
962 |
|
|
963 |
|
sources = ft_mem_table_alloc( table, sizeof(*sources) * count ); |
964 |
|
|
965 |
|
count = 0; |
966 |
|
for ( bucket = table->sources; bucket < limit; bucket++ ) |
967 |
|
{ |
968 |
|
FT_MemSource source = *bucket; |
969 |
|
|
970 |
|
for ( ; source; source = source->link ) |
971 |
|
sources[count++] = source; |
972 |
|
} |
973 |
|
|
974 |
|
ft_qsort( sources, count, sizeof(*sources), ft_mem_source_compare ); |
975 |
|
|
976 |
printf( "FreeType Memory Dump: current=%ld max=%ld total=%ld count=%ld\n", |
printf( "FreeType Memory Dump: current=%ld max=%ld total=%ld count=%ld\n", |
977 |
table->alloc_current, table->alloc_max, table->alloc_total, table->alloc_count ); |
table->alloc_current, table->alloc_max, table->alloc_total, table->alloc_count ); |
978 |
printf( " block block sizes sizes sizes source\n" ); |
printf( " block block sizes sizes sizes source\n" ); |
980 |
printf( "-------------------------------------------------\n" ); |
printf( "-------------------------------------------------\n" ); |
981 |
fmt = "%6ld %6ld %8ld %8ld %8ld %s:%d\n"; |
fmt = "%6ld %6ld %8ld %8ld %8ld %s:%d\n"; |
982 |
|
|
983 |
for ( ; bucket < limit; bucket++ ) |
for ( nn = 0; nn < count; nn++ ) |
984 |
{ |
{ |
985 |
FT_MemSource source = *bucket; |
FT_MemSource source = sources[nn]; |
986 |
|
|
987 |
for ( ; source; source = source->link ) |
printf( fmt, |
988 |
{ |
source->cur_blocks, source->max_blocks, |
989 |
printf( fmt, |
source->cur_size, source->max_size, source->cur_max, |
990 |
source->cur_blocks, source->max_blocks, |
FT_FILENAME( source->file_name ), |
991 |
source->cur_size, source->max_size, source->cur_max, |
source->line_no ); |
|
FT_FILENAME( source->file_name ), |
|
|
source->line_no ); |
|
|
} |
|
992 |
} |
} |
993 |
printf( "------------------------------------------------\n" ); |
printf( "------------------------------------------------\n" ); |
994 |
|
|
995 |
|
ft_mem_table_free( table, sources ); |
996 |
} |
} |
997 |
} |
} |
998 |
|
|