Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!rochester!cornellcs!newsstand.cit.cornell.edu!portc01.blue.aol.com!newsxfer2.itd.umich.edu!howland.erols.net!news.mathworks.com!fu-berlin.de!unlisys!blackbush.xlink.net!ins.net!heeg.de!hmm
From: hmm@heeg.de (Hans-Martin Mosner)
Subject: Re: VisualWorks Out of Memory Error
Message-ID: <Dzo5Ln.2s9@heeg.de>
Sender: uucp@heeg.de
Organization: Georg Heeg Objektorientierte Systeme, Dortmund, FRG
X-Newsreader: TIN [version 1.2 PL2]
References: <54gdl5$bn1@engr.orst.edu> <5vramsvywt.fsf@bird.twinsun.com>
Date: Tue, 22 Oct 1996 08:44:10 GMT
Lines: 71

John Rickenbrode (johnr@bird.twinsun.com) wrote:

: langfob@research.CS.ORST.EDU (Bill Langford) writes:
: >  I have just started using VisualWorks 2.5 on a Solaris machine.  I
: > was doing something that used a lot of memory, but I assumed that
: > virtual memory would take care of it and it would just cost me a lot
: > of swapping.  Instead, after a long run I got a "Fatal Error: Out of
: > Memory" message and VisualWorks died.  Can someone tell me why this
: > happens and how to get around it?
: > 
: > Thanks, Bill
: > 


: I'm also experiencing this problem (also on Solaris).  By tracing it
: in GDB, I found that the scavenger seemed to be calling exit.  I
: was definitely not running out of memory as far as the OS was
: concerned.  I've reproduced it when my VW size was only 20MB total.

: Unfortunately, I need my full application along with several external
: libraries to reproduce it, so I haven't tried PPD support yet.  

: John Rickenbrode
: john@twinsun.com

There are several places in the ObjectEngine that can cause this kind of
error. They are all related to registering objects in a table that is
dynamically allocated from OldSpace memory. The problem is that the
system does not attempt to get more memory from the operating system
when no more suitable OldSpace free blocks are available.
One way of getting this error consistently on my Sun IPX is this
piece of code. I wrote it to reproduce a customer's problem, and it indeed
crashes the VM, but with another error message. Anyway, it's related
to the same basic problem. I do not know whether ParcPlace is aware of
the problem, as I have been too busy lately to write an orderly bug report :-(
So here's the code:

| all newObject oldOM ivars check om |
oldOM := ObjectMemory current.
ivars := oldOM class instVarNames.
check := [:string |
	om := ObjectMemory current.
	Transcript show: '---', string; cr.
	1 to: om class instSize do: [:i | | diff old new |
		new := om instVarAt: i.
		old := oldOM instVarAt: i.
		diff := new isInteger ifTrue: [new-old] ifFalse: [0].
		diff = 0 ifFalse: [Transcript nextPutAll: (ivars at: i); tab.
						diff>0 ifTrue: [Transcript nextPut: $+].
						Transcript print: diff; cr]].
	Transcript show: '---'; cr.
	oldOM := ObjectMemory current].
100000 to: 101000 by: 500 do: [:size |
ObjectMemory garbageCollect.
check value: 'Before Array new'.
all := Array new: size.
1 to: size do: [:i | all at: i put: (Array new: 1)].
check value: 'After Array new'.
ObjectMemory garbageCollect.
newObject := String new.
check value: 'Before Assign'.
1 to: size do: [:i | (all at: i) at: 1 put: newObject].
check value: 'After Assign']

Hans-Martin

--
+--- Hans-Martin Mosner ---- Senior Smalltalk Guru :-) ---+
| These opinions are entirely ficticious.  Any similarity |
| to real opinions is purely coincidental and unintended. |
+--- <hmm@heeg.de> ------ URL:http://www.heeg.de/~hmm/ ---+
