Wasm: memory corruption
yowl opened this issue · comments
There is something odd still, perhaps around allocating objects.
var a = new Exception[] { new ArgumentException(), null, null};
PrintLine(a.Length.ToString());
This prints 12
when it should be 3
. This code
var a = new Exception[] { null, null, null};
PrintLine(a.Length.ToString());
Prints 3
correctly.
There's also this intermittent crash which might be related
Assertion failed: ((CObjectHeader*)p)->IsFree(), at: E:/GitHub/corert/src/Native/Runtime/Portable/../../gc/gc.cpp,3806,unused_array_size
exception thrown: RuntimeError: abort(Assertion failed: ((CObjectHeader*)p)->IsFree(), at: E:/GitHub/corert/src/Native/Runtime/Portable/../../gc/gc.cpp,3806,unused_array_size) at Error
at jsStackTrace (E:\GitHub\corert\tests\src\Simple\HelloWasm\bin\Debug\wasm\native\HelloWasm.js:2146:17)
at stackTrace (E:\GitHub\corert\tests\src\Simple\HelloWasm\bin\Debug\wasm\native\HelloWasm.js:2163:16)
at abort (E:\GitHub\corert\tests\src\Simple\HelloWasm\bin\Debug\wasm\native\HelloWasm.js:1907:44)
at ___assert_fail (E:\GitHub\corert\tests\src\Simple\HelloWasm\bin\Debug\wasm\native\HelloWasm.js:2637:7)
at WKS::gc_heap::soh_try_fit(int, unsigned long, alloc_context*, unsigned int, int, int*, int*) (wasm-function[21522]:0x100a9f7)
at WKS::gc_heap::allocate_soh(int, unsigned long, alloc_context*, unsigned int, int) (wasm-function[21524]:0x100bf22)
at WKS::gc_heap::try_allocate_more_space(alloc_context*, unsigned long, unsigned int, int) (wasm-function[21537]:0x10125e8)
at WKS::gc_heap::allocate_more_space(alloc_context*, unsigned long, unsigned int, int) (wasm-function[21540]:0x1012d6a)
at WKS::GCHeap::Alloc(gc_alloc_context*, unsigned long, unsigned int) (wasm-function[21884]:0x10a84dd)
at RhpGcAlloc (wasm-function[20535]:0xf9fd04),RuntimeError: abort(Assertion failed: ((CObjectHeader*)p)->IsFree(), at: E:/GitHub/corert/src/Native/Runtime/Portable/../../gc/gc.cpp,3806,unused_array_size) at Error
at jsStackTrace (E:\GitHub\corert\tests\src\Simple\HelloWasm\bin\Debug\wasm\native\HelloWasm.js:2146:17)
at stackTrace (E:\GitHub\corert\tests\src\Simple\HelloWasm\bin\Debug\wasm\native\HelloWasm.js:2163:16)
at abort (E:\GitHub\corert\tests\src\Simple\HelloWasm\bin\Debug\wasm\native\HelloWasm.js:1907:44)
at ___assert_fail (E:\GitHub\corert\tests\src\Simple\HelloWasm\bin\Debug\wasm\native\HelloWasm.js:2637:7)
at WKS::gc_heap::soh_try_fit(int, unsigned long, alloc_context*, unsigned int, int, int*, int*) (wasm-function[21522]:0x100a9f7)
at WKS::gc_heap::allocate_soh(int, unsigned long, alloc_context*, unsigned int, int) (wasm-function[21524]:0x100bf22)
at WKS::gc_heap::try_allocate_more_space(alloc_context*, unsigned long, unsigned int, int) (wasm-function[21537]:0x10125e8)
at WKS::gc_heap::allocate_more_space(alloc_context*, unsigned long, unsigned int, int) (wasm-function[21540]:0x1012d6a)
at WKS::GCHeap::Alloc(gc_alloc_context*, unsigned long, unsigned int) (wasm-function[21884]:0x10a84dd)
at RhpGcAlloc (wasm-function[20535]:0xf9fd04)
at abort (E:\GitHub\corert\tests\src\Simple\HelloWasm\bin\Debug\wasm\native\HelloWasm.js:1913:11)
at ___assert_fail (E:\GitHub\corert\tests\src\Simple\HelloWasm\bin\Debug\wasm\native\HelloWasm.js:2637:7)
at WKS::gc_heap::soh_try_fit(int, unsigned long, alloc_context*, unsigned int, int, int*, int*) (wasm-function[21522]:0x100a9f7)
at WKS::gc_heap::allocate_soh(int, unsigned long, alloc_context*, unsigned int, int) (wasm-function[21524]:0x100bf22)
at WKS::gc_heap::try_allocate_more_space(alloc_context*, unsigned long, unsigned int, int) (wasm-function[21537]:0x10125e8)
at WKS::gc_heap::allocate_more_space(alloc_context*, unsigned long, unsigned int, int) (wasm-function[21540]:0x1012d6a)
at WKS::GCHeap::Alloc(gc_alloc_context*, unsigned long, unsigned int) (wasm-function[21884]:0x10a84dd)
at RhpGcAlloc (wasm-function[20535]:0xf9fd04)
at RhpNewArray (wasm-function[20696]:0xfa9a36)
at S_P_CoreLib_System_Diagnostics_StackTrace__InitializeForCurrentThread (wasm-function[842]:0x7aa15)