While looking at other things I did this small program that summaries the string memory
void main() { string x = ""; mapping m = ([]); do { x = _next(x); m[ (sizeof(x)*String.width(x))/1024*1024 ]++; } while( x!="2"); write("%O\n", m); }
and to my surprise there are some really large ones right at startup. Do they originate from the type system? Getting them to not be wide strings would be a great first step.
([ /* 33 elements */ 0: 2098, 1024: 76, 2048: 41, 3072: 26, 4096: 13, 5120: 14, 6144: 4, 7168: 4, 8192: 4, 9216: 3, 10240: 5, 11264: 2, 12288: 3, 13312: 4, 14336: 2, 15360: 1, 16384: 3, 17408: 2, 18432: 1, 20480: 1, 21504: 1, 22528: 1, 23552: 1, 25600: 1, 28672: 1, 30720: 1, 39936: 2, 59392: 1, 66560: 1, 71680: 1, 99328: 1, 117760: 1, 190464: 1 ])
The large wide strings at startup are most likely the bytecode for the master and related modules.
They are not quite as large as you make them seem since you multiply by String.width() instead of String.width()/8. :-)
There seems to be a single 32-bit string with about 6000 characters in it. Maybe it comes from the Unicode module?
I'm not sure what you mean by "getting them to not be wide strings"; that would imply removing all non-latin1 characters from the strings, which would of course alter the semantics...
pike-devel@lists.lysator.liu.se