Watch the size of your structs…

I’ve gotten somewhat careless. I hadn’t noticed that the struct defining a thread is now 392 bytes, so its inclusion in the Arcueid cell structure means that the struct had become 400 bytes in size. This meant that every boxed object used up at least 400 bytes! By modifying the way thread objects are allocated, I removed the explicit definition of the thread struct from a cell, and so reduced the size of the cell struct to 48 bytes. Now, on loading arc.arc, the initial virtual size of the Arcueid process has gone down from 130 megs to only 41. After loading libs.arc, the virtual size has gone down from over 400 megs to about 170. After using ab to do the same test as below, virtual size is 283 megs, from over 1.6 gigs before. It’s still a lot, but a lot less than before, and the rest of the excess memory usage seems to come largely from fragmentation. Actual memory usage as reported by the garbage collector shows only about 3 megs of actual memory used by stuff reachable via the roots, after loading arc.arc, and 7.8 megs after loading libs.arc. Fragmentation still appears to be a big problem.

~ by stormwyrm on 2012-02-15.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

 
%d bloggers like this: