Large array slows down Squeak
Stephan Rudlof
sr at evolgo.de
Tue May 30 15:19:09 UTC 2000
Stefan,
I'm not an ObjectMemory specialist, but I have some theoretical thoughts
about your problem.
Stefan Matthias Aust wrote:
>
> Hi,
>
> I just noticed that an
>
> Array new: 10000000 "ten millions"
>
> noticablely slows down Squeak (open it in an inspector or assign
> it to a global (or workspace) variable). Actually, it's now nearly
> impossible to work with Squeak. If I do a
>
> ByteArray new: 40000000
>
> which should take the same amount of memory, no such effect occurs
> so I guess it's a garbage collector issue. Right?
Just some theoretical thoughts:
For a big Array the garbage collector has to look for *every* element to
check,
- if it is a valid (notNil) object pointer, and if so
- if it has references to other object pointers,
if it wants to gc *not* referenced objects (since the big Array is
reachable from the root objects).
For the ByteArray this is not the case, because its elements are not
object pointers by definition.
I think this is a plausible explanation for the problem.
> Is there a
> workaround?
If you have object pointers to store into the Array then I see two
possibilities (in principle):
- look for a method which excludes this Array from gc -> don't know how;
- use a ByteArray and convert the objects to be stored into a flat
representation, which is storable as bytes, and vice versa if you want
to use this flat representation as objects.
Greetings,
Stephan
>
> bye
> --
> Stefan Matthias Aust Projektleiter/Softwareentwicklung
> Baltic Online Computer GmbH, Alter Markt 1-2, 24103 Kiel
> Fon: +49 (0) 431-54003-0 Fax: -99 http://www.baltic-online.de
--
Stephan Rudlof (sr at evolgo.de)
"Genius doesn't work on an assembly line basis.
You can't simply say, 'Today I will be brilliant.'"
-- Kirk, "The Ultimate Computer", stardate 4731.3
More information about the Squeak-dev
mailing list
|