IDE: Water
Version: 10.0.0.2372
Target: Island(WebAssembly)
Description:
Assigning an object to a global variable and then nil-ing it raises a “RuntimeError: memory access out of bounds” exception.
Expected Behavior:
It should nil the reference and release the object if it has no more references.
Actual Behavior:
It raises an exception.
Steps:
Create a new webassembly module, build this code and run:
@Export public class Program { var obj: Object! public func HelloWorld() { obj = Object() obj = nil //raises an exception } }
This example uses an object of type Object but it can also be something else. I initially encountered it with a custom object.