HaxeFoundation / HaxeFoundation/haxe
Fatal error: exception Out of memory when targeting Hashlink
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
It looks like two classes with duplicate private types causes this error when targeting hl. I've [setup a repo](https://github.com/skial/hl-out-of-memory-error) with all the code and generated dump files.
```Haxe
// Main.hx
class Main {
public static function main() {
new Test1().test();
new Test2().test();
}
}
// Test1.hx
class Test1 {
public function new() {}
public function test() {
var _foo:Foo = new FooLike();
}
}
// Test2.hx
class Test2 {
public function new() {}
public function test() {
var _foo:Foo = new FooLike();
}
}
```
With both `Test1.hx` and `Test2.hx` having these two types at the end:
```Haxe
private typedef Foo = {
function make(v:T):Foo;
}
private class FooLike {
public function new() {}
public function make(v:T):FooLike return this;
}
```
And the stack trace.
```
OCAMLRUNPARAM=b haxe build.hxml
Fatal error: exception Out of memory
Raised by primitive operation at file "pMap.ml", line 81, characters 20-27
Called from file "pMap.ml", line 122, characters 16-23
Called from file "_build/src/generators/hlcode.ml", line 386, characters 5-22
Called from file "array.ml", line 90, characters 31-48
Called from file "_build/src/generators/hlcode.ml", line 410, characters 2-41
Called from file "array.ml", line 90, characters 31-48
Called from file "_build/src/generators/hlcode.ml", line 408, characters 1-188
Called from file "_build/src/generators/genhl.ml", line 3628, characters 25-42
Called from file "_build/src/generators/genhl.ml", line 4074, characters 2-65
Called from file "_build/src/compiler/main.ml", line 343, characters 2-14
Called from file "_build/src/compiler/main.ml", line 1059, characters 25-62
Re-raised at file "_build/src/compiler/main.ml", line 1205, characters 2-11
Called from file "_build/src/compiler/main.ml", line 633, characters 3-11
Called from file "_build/src/compiler/main.ml", line 1220, characters 1-35
```
Contributor guide
Assessment
This issue has not been assessed yet.