Tracking VAST memory usage in run-time

VA Smalltalk is a "100% VisualAge compatible" IDE that includes the original VisualAge technology and the popular VA Assist and WidgetKit add-ons.

Moderators: Eric Clayberg, wembley, tc, Diane Engles, solveig

Tracking VAST memory usage in run-time

Postby davidg » Sat May 09, 2009 12:43 am


we have multiple web servers in VAST which consume quite a lot of memory due to high user loads.

Sometimes it happens that junior programmers introduce a memory leak in the code which can cause the server image to grow over the size of available memory which slows down the servers.

So, I wanted to introduce a memory watchdog process which would keep track of memory usage changes and alarm the system administrator before things go wrong.

Getting the memory usage was easy, but when I wanted to add monitoring of the number of instances of specific classes I have noticed that in run-time evaluating "aClass allInstances size" will always answer 1.

Is there any way to make the method #allInstances working in run-time, or is there any other way to get the number of instances of a particular class?
Posts: 6
Joined: Mon Dec 25, 2006 5:42 am

Re: Tracking VAST memory usage in run-time

Postby tc » Sat May 09, 2009 3:46 pm


AFAIK, allInstances should work. Do you see different results for a dev and runtime image? Does this happen for all classes or one particular class?

Posts: 304
Joined: Tue Oct 17, 2006 7:40 am
Location: Raleigh, NC

Re: Tracking VAST memory usage in run-time

Postby waynej » Sun May 10, 2009 5:58 am

Some things you might find useful if the problem isn't always simply the number of instances of one class that you know ahead of time:

EsbTimer vmStats numberOfScavenges.
EsbTimer vmStats numberOfGlobalGCs.
EsbTimer vmStats millisecondScavengeTime.
EsbTimer vmStats millisecondGlobalGCTime.

countAllMemoryUsingSelector: #countInstances
minCount: 1
minSize: 1
output: Transcript.

System totalAllocatedMemory.
System availableMemory.
System availableNewSpaceMemory.
System availableOldSpaceMemory.

"Unrelated, but can be interesting"
Processor allProcesses collect: [:aProcess |aProcess processName -> aProcess switchCount]
Posts: 32
Joined: Wed Apr 18, 2007 9:18 am

Return to VA Smalltalk 7.0, 7.5 & 8.0

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest