Branch: Tag:

2013-09-20

2013-09-20 14:46:08 by Per Hedbor <ph@opera.com>

Fixed multiset and mapping size calculations in rec_size_svalue.

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.

164:   PMOD_EXPORT void f_function_defined(INT32 args);   void init_builtin_efuns(void);   void exit_builtin_efuns(void); + unsigned int rec_size_svalue( struct svalue *s, struct mapping **m );      /* From iterators.cmod. */   PMOD_EXPORT void f_get_iterator(INT32 args);