On Mon, 23 Feb 2009, Phil Stone wrote:
Just to see the magnitude of the issue, I made a little test patch (attached) called [symbol_pig]. It just creates symbols, very fast. A very rough measurement based on watching resident memory increasing in bash's top command indicates that (on OS X 10.4), a megabyte is used up for approximately every 32,000 symbols.
Each t_symbol is a 12-byte malloc (double that in 64-bit mode) and another malloc the size of the text plus one. Malloc overhead varies (as I said in the previous mail), but if you add 4 bytes and round to the next multiple of 16, that's almost the least RAM a malloc-function can use up for your malloc. So, 16+16=32 bytes per small symbol, that makes a megabyte.
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801, Montréal, Québec