-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Potential bug in tail-call optimizations with try/with block #54
Comments
It looks like Async builder has pretty intensive trampoline logic hidden beneath |
From what I've managed to learn, async builder itself is also leaking when used with |
what do you mean? it's not necessary to use |
@codingedgar There's an example of using non-CE actor function definition in README of this repo. However this specific issue is related to leaking Async usage in tail calls and I'm not really sure, there's an easy way out of this (also: since the issue was posted, the internals of F# Async changed massivelly, so this issue should be reevaluated). |
Related issue found on SO: http://stackoverflow.com/questions/43714625/tail-call-seems-disabled-by-an-enclosing-try-block-in-fsharp-akka-but-not-usin
Content
Consider the following two skeletal snippets, A and B. In both cases, return! is the last executed operation and, IMHO, should be optimised like a tail call
Scenario A - here return! is properly optimised and the runtime stack is kept constant
Scenario B - here return! is not interpreted as a tail call anymore and the runtime stack keeps growing, possibly leading to stack overflow exceptions
The only difference is the try block which encloses the actor implementation. Note that the corresponding MailboxProcessor scenarios are both optimised as tail calls
The text was updated successfully, but these errors were encountered: