EsMemorySegment>>delete is to slow

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

EsMemorySegment>>delete is to slow

Postby Michael Keppler » Thu Feb 26, 2009 3:11 am


we have a use case where we need to load hundreds of objects with the ObjectSwapper. That works fine, but is slow, because each of those objects is a single dump (we cannot change that) and therefore after each loaded object a memory segment is freed (invoked from ObjectSwapper>>#deleteSegments:). Deleting a memory segment is a VM function, which really takes a long time (even on a current system, I can only delete about 20 to 30 memory segments per second).

My question is: Can another (faster) function be used to get rid of the memory segment? We tried EsMemorySegment>>invalidate instead (which is normally used during image loading). That performs much faster, but the application will crash (typically on shutdown). Our guess is that EsMemorySegment>>delete does a lot of work to get rid of all object pointers and so on, which is probably not needed in the special case of the ObjectSwapper (because all objects have been extracted from that memory segment), so at least in theory a faster alternative should exist.

Any thoughts on that?

Ciao and thanks, Michael

BTW: As a kind of workaround I implemented lazy memory segment deletion in the ObjectSwapper. That means the segments are collected and are only destroyed when the CPU is free (or an upper limit of used memory is reached). Do you see any problems with such an approach?
Michael Keppler
Posts: 28
Joined: Wed Feb 27, 2008 4:33 am

Return to VA Smalltalk 7.0, 7.5 & 8.0

Who is online

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