[Self-interest] memory systems in Linux and Mac virtual machines
Jecel Assumpcao Jr
jecel at merlintec.com
Wed Apr 6 00:59:32 UTC 2022
A while back I wanted to show off the Self spy to illustrate a point to
a friend. To stress the memory system so it would be clear how it worked
I started by creating a small vector:
vector copySize: 1000
and then filled it in with a bunch of other vectors:
0 to: size-1 Do: [| :i | at: i Put: (vector copySize: 10)]
then at each step I doubled the size of the leaf vectors:
0 to: size-1 Do: [| :i | at: i Put:
(vector copySize: 2*(at:i) size)]
Just to keep track where we were, after each step I would evaluate
(at: 0) size
As expected, the system was forced to create a new segment by the time I
got to 2560. It crashed on the next step, though sometimes I got one
more step before it crashed. At this point the heap is only a few
megabytes in size, so this shouldn't be a problem.
This was a 2017 Linux virtual machine. Today I had the idea to try the
exact same thing on a 2017 Macintosh virtual machine. With it I was able
to get all the way up to 81920 and it didn't crash like in Linux but the
infamous colored beachball has been spinning for a couple of hours now.
Not counting object headers, this step is trying to grow the heap from
about 320MB to around twice that. The spy showed exactly what I wanted
to illustrate with the old space having grown to around 90 segments.
I had expected the behavior of both VMs to be the same, but it seems
that the Linux version it less stable. Does anyone else have a similar
experience?
-- Jecel
More information about the Self-interest
mailing list