Skip to content
Snippets Groups Projects
  • Per Hedbor's avatar
    697883e5
    Fixed multiset and mapping size calculations in rec_size_svalue. · 697883e5
    Per Hedbor authored
    Also handle values that show up multiple times in an object correctly
    (before an object with two intances of the same value only got the
    first one counted, then divided by the refs. Now both are included in
    the total size).
    
    As an example:
    
    | class foo { string a; string b; }
    | string q = random_string(10000);
    |
    | > (f->a = q), _size_object(f);
    | (1) Result: 5072
    | > (f->b = q), _size_object(f);
    | (2) Result: 6744
    | > (q=0), _size_object(f);
    | (3) Result: 10088
    
    rec_size_svalue is now public, and used from as an example the
    ADT.List class.
    697883e5
    History
    Fixed multiset and mapping size calculations in rec_size_svalue.
    Per Hedbor authored
    Also handle values that show up multiple times in an object correctly
    (before an object with two intances of the same value only got the
    first one counted, then divided by the refs. Now both are included in
    the total size).
    
    As an example:
    
    | class foo { string a; string b; }
    | string q = random_string(10000);
    |
    | > (f->a = q), _size_object(f);
    | (1) Result: 5072
    | > (f->b = q), _size_object(f);
    | (2) Result: 6744
    | > (q=0), _size_object(f);
    | (3) Result: 10088
    
    rec_size_svalue is now public, and used from as an example the
    ADT.List class.