This post originated from an RSS feed registered with Agile Buzz
by James Robertson.
Original Post: Out of Memory exception in VW 7.2
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'm noticing that developers are reporting an "out of memory" exception in VW 7.2, with no idea how they are getting it (typically at image start). Here's the likely cause - Loading the VisualWave (Web Toolkit) server and not resetting ObjectMemory policies. In 7.2, loading the server resets the memory settings in a way that is appropriate to a server with lots of memory - but not necessarily for a client. Try this:
load WebToolkit
Now execute ObjectMemory sizesAtStartup
You'll see something like this: #(10.0 10.0 250.0 1.0 1.0 5.0 1.0). Look carefully at that third value - 250.0. What these numbers represent are multipliers - how much bigger to make a specific segment of VW's Object Memory at startup. That third one is LargeSpace. The reason it's been expanded has to do with appropriate sizes of socket buffers in a web application system. If you save your image in this state, it will try to allocate 250X of the third value returned by ObjectMemory defaultSizesAtStartup (204,800 bytes on my Windows box). That means that your system is going to ask for a lot of RAM (51MB on my system) for LargeSpace at startup. The exception means that the OS wouldn't yield up that much RAM to your process.
The solution? For development, do something like this before saving your image: ObjectMemory sizesAtStartup: #(10.0 10.0 10.0 1.0 1.0 5.0 1.0). Save your image, and you'll have more reasonable defaults for a development system. For a deployed server, the 250x may be more appropriate, but that depends on the specific configuration (RAM, swap space, etc) of your server - check the class comment and class side documentation of ObjectMemory for details