How to enable haxe GC on my manual allocated instance?

52 views
Skip to first unread message

Tiger Chan

unread,
Jun 21, 2017, 9:46:07 AM6/21/17
to Haxe
My C++ host application included my haxe static library and call hxRunLibrary(), I have try "new" a haxe class, or get an instance new in haxe (objectPtr and cast), and forever call testLeak()

package;

class HaxeLibrary{
 
public static function main(){}
 
public function new(){}
 
public function testLeak():Int{
 
var world2:World2 = new World2();
 
return 0;

 
}
}

I got an error below:

0  0x000000000042484e  hx::MarkAllocUnchecked(void*, hx::MarkContext*)    
1  0x0000000000433f4b  hx::Class_obj::__Mark(hx::MarkContext*)    
2  0x00000000004950ef  GlobalAllocator::ThreadLoop(int)    
3  0x0000000000495d02  GlobalAllocator::SThreadLoop(void*)    
4  0x00000000771259cd  KERNEL32!BaseThreadInitThunk    
5  0x000000007725a2e1  ntdll!RtlUserThreadStart    
6  0x0000000000000000  ??    

I found that AutoGCRoot but not enough knowledge of how to convert between haxe ObjectPtr and haxe value.
Message has been deleted

Tiger Chan

unread,
Jun 22, 2017, 2:03:55 AM6/22/17
to Haxe
I got this error with a fixed iteration(around 300,000 times call) within few seconds, below is my compiler args:

haxe -main World -cp world/src -cpp cpp -D static_link -lib hxcpp -D mingw -D HXCPP_M64 -D HXCPP_BIG_ENDIAN -D DHXCPP_STACK_TRACE

I tried to remove HXCPP_BIG_ENDIAN flag, and it never crash at least 10 minutes(I terminated).

This seems not relevant to GC then? But error throw on exactly number of calls every run.

Tiger Chan於 2017年6月21日星期三 UTC+8下午9時46分07秒寫道:
Reply all
Reply to author
Forward
0 new messages