This post originated from an RSS feed registered with Agile Buzz
by James Robertson.
Original Post: A thought on memory usage
Feed Title: Cincom Smalltalk Blog - Smalltalk with Rants
Feed URL: http://www.cincomsmalltalk.com/rssBlog/rssBlogView.xml
Feed Description: James Robertson comments on Cincom Smalltalk, the Smalltalk development community, and IT trends and issues in general.
I made a comment in this post's comments about the memory requirements for BottomFeeder. By extension, it was about memory usage in VisualWorks applications in general. With that in mind, let's take a look at that. If I bring up a base VW 7.3 development image, and execute ObjectMemory dynamicallyAllocatedFootprint, I find that I'm using 14 MB of memory. Where is that coming from? There are two places:
Perm Space - all the classes and objects that start off in the image
The rest of the memory spaces:
Eden
SurvivorSpace
LargeSpace
StackSpace
CompiledCodeCache
OldSpaceHeadroom
FixedSpaceHeadroom
You can't do much about perm space without doing a strip (typically with RuntimePackager). The other spaces are well documented in the class side comments of ObjectMemory. You can find out how much space they take up this way: ObjectMemory actualSizes. That will return an array full of numbers, representing the bytes used. In a base (development) image, they look like this:
#(307200 61440 204800 40960 655360 591904 204800)
You can adjust those with the #sizesAtStartup: message - it allows you to send multipliers (x factors) by which to make those bigger. For instance, if you are going to be creating lots of objects quickly, it might make sense to make Eden and the survivor spaces bigger. That's still not a lot of space - at present, BottomFeeder is taking 65 MB on my desktop. Most of that is oldSpace - i.e., objects that have become permenent within the context of the runtime - my feeds, items, etc.
I mentioned that I had preloaded a lot of code - I have. Things like Opentalk, all the network libraries, SOAP, just rafts of stuff. That's something like 16MB of stuff in my base image. Now, I'm not really trying to limit what I load or take stuff out at all - I pretty much just package the image (i.e., make it a runtime) and go. You can do a lot better, and many people do. For instance, Liberty Basic - that's a 3mb download, and it's a Smalltalk application.