Charles Oliver Nutter wrote:
run rails in dev mode, request index, request info:
{0=8561, 1=3706, 2=2254, 3=789, 4=323, 5=168, 6=97, 7=51, 8=28, 9=24,
10=7, 11=9, 12=3, 13=6, 14=3, 15=5, 19=1, 20=1, 23=1, 22=1, 25=2, 28=1}
It occurred to me after I sent this that this is a crapload of static
scopes. Memory concerns sprang to mind.
This is 16041 static scopes created during the entire runtime. Some of
these will go away, certainly, but most are attached to method and
closure bodies that stick around.
Currently, StaticScope instances are rather large:
(32-bit JVM numbers given; 64-bit could be twice as large)
11 fields = 44 bytes
2-word object header = 8 bytes
So that's 834KiB just for StaticScope objects. Adding in the variable
name lists:
name list array header = 3 words = 12 bytes
* 7480 scopes likely to have names = 89KiB
Array elements are 4 bytes, so array contents:
4 * (3706 + 2*2254 + 3*789 + 4*323 + 5*168 + 6*97) = 53KiB
And every scope holds a reference to a NoVarsDynamicScope:
16041 * (8 byte header + 20 bytes of fields) = 449KiB
A grand total of 1425KiB, or almost 1.5MB just for static variable scope
information. I think I could trim off most of the 449KiB by lazily
constructing that scope, so that's something. But for the rest, maybe we
can consider packing ints and booleans a bit.
- Charlie
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email