AnyDSL / thorin

The Higher-Order Intermediate Representation
https://anydsl.github.io
GNU Lesser General Public License v3.0
150 stars 15 forks source link

Memory usage explodes #3

Open RalfJung opened 10 years ago

RalfJung commented 10 years ago

Some seemingly harmless changes can make the impala memory usage explode. See the branch https://github.com/AnyDSL/imbatracer/commits/memleak of imbatracer. The last commit adds a simple (10-line) file that's not even used, which triggers the problem. Another example triggering the problem is adding an external function call as in https://github.com/AnyDSL/imbatracer/commit/b2eaa4a7295f8a275030b74fe915e230a74f6970.

leissa commented 8 years ago

The code is not first-order recursive. We are going to address this in a future version of Thorin.

richardmembarth commented 7 years ago

Same problem here: https://github.com/AnyDSL/imbatracer/commits/forever

leissa commented 7 years ago

Test case: https://github.com/AnyDSL/impala/blob/master/test/codegen/endless_mangling.impala

wizzard0 commented 7 years ago

btw what does "!" means in the endless_mangling example?

leissa commented 7 years ago

A function fn foo(x: int) -> ! has type fn(int) -> ! which means that the function is a continuation. Calling this function does not return. An expression, calling a continuation has type <no-return>.

fn foo(x: int) -> int is syntactic sugar for fn foo(x: int, return: fn(int) -> !) -> !.

leissa commented 7 years ago

see also: