pike.git / src / builtin_functions.c

version» Context lines:

pike.git/src/builtin_functions.c:7376:    COUNT(mapping);    COUNT(marker);    COUNT(mc_marker);    COUNT(multiset);    COUNT(node_s);    COUNT(object);    COUNT(pike_frame);    COUNT(pike_list_node);    COUNT(pike_type);    COUNT(program); -  COUNT(short_pike_string); +     COUNT(string);   #ifdef PIKE_DEBUG    COUNT(supporter_marker);   #endif      #ifdef DEBUG_MALLOC    {    extern void count_memory_in_memory_maps(size_t*, size_t*);    extern void count_memory_in_memory_map_entrys(size_t*, size_t*);    extern void count_memory_in_memlocs(size_t*, size_t*);
pike.git/src/builtin_functions.c:7414:    It should not include the size of the svalue itself, so the basic    types count as 0 bytes.       This is an estimate mainly because it is very hard to know to whom    a certain array/mapping/multiset or string "belongs".       The returned size will be the memory usage of the svalue divided by    the number of references to it.   */    - struct string_header - { -  PIKE_STRING_CONTENTS; - }; -  +    unsigned int rec_size_svalue( struct svalue *s, struct mapping **m )   {    unsigned int res = 0;    int i;    ptrdiff_t node_ref;    INT32 e;    struct svalue *x;    struct keypair *k;       switch( TYPEOF(*s) )    {    case PIKE_T_STRING: -  /* FIXME: This makes assumptions about the threshold for short strings. */ +     if( s->u.string->flags & STRING_IS_SHORT ) -  return (16+sizeof(struct string_header)) / s->u.string->refs; -  return ((s->u.string->len << s->u.string->size_shift) + -  sizeof(struct string_header)) / s->u.string->refs; +  return (2*sizeof(struct pike_string)) / s->u.string->refs; +  return (((s->u.string->len+1) << s->u.string->size_shift) + +  sizeof(struct pike_string)) / s->u.string->refs;    case PIKE_T_INT:    case PIKE_T_OBJECT:    case PIKE_T_FLOAT:    case PIKE_T_FUNCTION:    case PIKE_T_TYPE:    return 0;    }    if( !m ) return 0;       if( !*m )