Memory access out of bounds when nil-ing object in WebAssembly

(Marko Zubin) #1

IDE: Water
Target: Island(WebAssembly)
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.

Create a new webassembly module, build this code and run:

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.

(RemObjects) #2

Thanks, logged as bugs://81949

(RemObjects) #3

bugs://81949 got closed with status fixed.