Closed jordanmontt closed 3 months ago
Thanks. I do not get why we have this behavior because I thought that we handled the meta recursion.
Yes, indeed. The weirdest is that only happens with Strings. With other allocations, the meta recursion is handled as expected.
Fixed!
When one installs a proxy allocator methods (see below) and when one uses
String streamContents: [:s | ]
and aasString
; the image enters to an infinite recursion of allocations.To reproduce
First, create a simple Handler class:
and add a
beforeMethod
that getasString
of any object.Now, if you run this script on a Playground (or a test, doesn't matter), the image will be frozen.
This is because we end up doing infinite allocations because of a recursion.
This problem does not occur when proxing the same allocator methods but allocating anything else, but no a
String
. For example, if we have our before method like this.No recursion happens. So, the issue happens to be related to the
String streamContents: [ ]
and withasString
: related to theString
allocation.Other findings
if one puts in the before method
The behavior is uncertain. Sometimes it hags the image, and sometimes don't.