HaxeFoundation / HaxeFoundation/haxe

hxcpp gc-mark bug caused wasm crash

Open
#7,698 0 comments 0 reactions 1 assignee Claimed by @hughsando View on GitHub
platform-cpp
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

Here is the more details about this crash:[https://github.com/HaxeFoundation/hxcpp/issues/760](https://github.com/HaxeFoundation/hxcpp/issues/760)

The wasm crash html page: [http://kuangyaozong.com/wasm-bunny_cpp-O1/](http://kuangyaozong.com/wasm-bunny_cpp-O1/) , you can open this link from Chrome or FireFox browser.

Just a brief description:
After an object of Bunny_obj is alloced in Bunny_obj::__alloc(), then gc happened in Bunny_obj::__construct(), at this time, this Bunny_obj* is a local variable, but unfortunatelly gc failed to mark for this ‘Bunny_obj’ local variable, then this Bunny_obj is released and its memory is collected finally。So,crash occurred !
This local variable is as the memory address of the Bunny_obj object in function Bunny_obj::__alloc() . In fact, the value of this local variable will return and becomes a member of an Object, it should not be collected by GC !
But the strange thing is: If compile Bunny.cpp with emcc compile flag "-O0", there is no crash, everthing is OK.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.