[Vm-dev] [Spur] endless recursion in forward become

Bert Freudenberg bert at freudenbergs.de
Thu Jun 16 12:11:09 UTC 2016


I'm reading a 20MB text file. At some point it tries to convert the 20 MB
ByteString into an 80 MB WideString using forward become. This fails
resulting in an endless loop. The primitive failure code for
elementsForwardIdentityTo: (primitive 72) is  #'insufficient object memory'
and it tries again after growing:

ec == #'insufficient object memory' ifTrue:
[Smalltalk garbageCollect < 1048576 ifTrue:
[Smalltalk growMemoryByAtLeast: 1048576].
^self elementsForwardIdentityTo: otherArray].

but the growMemoryByAtLeast: does not actually grow the memory:

{Smalltalk garbageCollect.
Smalltalk growMemoryByAtLeast: 1048576.
Smalltalk garbageCollect.}

==>  #(58576608 16777216 58576608)

58 MB are not enough, but it doesn't grow any further.

The question is, why does it try to allocate a new object at all? The
WideString exists already. I thought Spur would simply install a forwarder?

To reproduce, execute

(ByteString new: 20000000) writeStream nextPut: (Character value: 128169)

You probably want to follow that with a user interrupt (Cmd-period).

This happens using the latest Spur VM from github (r201606160944)

- Bert -
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20160616/432f74c0/attachment.htm


More information about the Vm-dev mailing list