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
I do get an early crash when I try your code on ourself.io Admittedly I am running the linux VM under the FreeBSD emulation layer, so it is quite possibly related to that.
Hmm, now I notice:
[Wed Apr 06 01:51:26 2022] info -- Scheduler started (according to snapshotAction schedulerInitial) owner@russell/terminalMorph 1> memory testHeapExpansion Self VM warning: some memory reserved by the VM has been used; invoking emergency heap expansion... Segmentation fault (core dumped)
That's not right! But it may not be the same issue you are seeing...
I haven't noticed much instability on a general basis but then I'm not doing anything which would use much memory.
(BTW if anyone has the time and inclination, I'd be very supportive of a proper FreeBSD port. There are also some smaller projects I could suggest for people who want to get started on the VM, for example making Self work with unix domain sockets...)
Russell
-----Original Message----- From: "Jecel Assumpcao Jr" jecel@merlintec.com Sent: Tuesday, April 5, 2022 8:59pm To: "Self-interest" self-interest@lists.selflanguage.org Subject: [Self-interest] memory systems in Linux and Mac virtual machines
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 _______________________________________________ Self-interest mailing list Self-interest@lists.selflanguage.org http://lists.selflanguage.org/mailman/listinfo/self-interest
Russell,
I do get an early crash when I try your code on ourself.io
Admittedly I am running the linux VM under the FreeBSD emulation layer, so it is quite possibly related to that.
I have not looked at the sources for the VM in the past couple of decades, but I remember Squeak having similar problems. Those were normally related to having pointers treated as signed integers which messed up some comparisons.
A complicating factor was at some point Linux stopped allocating space from address 0 up and started giving applications random locations in virtual address space in the name of security. That made heaps that previous seemed to work at up to 2GB suddenly cause problems at much smaller sizes in ways that were hard to reproduce.
Self originally ran on SunOS (I think), so a native FreeBSD port might be a reasonable project. But it might be too much for a Google Summer of Code student.
-- Jecel
self-interest@lists.selflanguage.org