Skip to content
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

[Relay][Interpreter] Build self referential closure only when letrec is defined #3448

Merged
merged 1 commit into from
Jun 28, 2019

Conversation

hlu1
Copy link
Contributor

@hlu1 hlu1 commented Jun 27, 2019

Self referential closure creates memory leaks. We can avoid this memory leak in cases where recursive functions are not used. As discussed in #3423, garbage collection or weak pointer is needed to fix the memory leak in the recursive case.

Before:

==3058763== LEAK SUMMARY:
==3058763==    definitely lost: 48 bytes in 1 blocks
==3058763==    indirectly lost: 128 bytes in 3 blocks
==3058763==      possibly lost: 82,062 bytes in 1,667 blocks
==3058763==    still reachable: 261,640 bytes in 4,301 blocks
==3058763==                       of which reachable via heuristic:
==3058763==                         stdstring          : 50,132 bytes in 1,037 blocks
==3058763==         suppressed: 0 bytes in 0 blocks

After:

==2878348== LEAK SUMMARY:
==2878348==    definitely lost: 0 bytes in 0 blocks
==2878348==    indirectly lost: 0 bytes in 0 blocks
==2878348==      possibly lost: 82,062 bytes in 1,667 blocks
==2878348==    still reachable: 261,640 bytes in 4,301 blocks
==2878348==                       of which reachable via heuristic:
==2878348==                         stdstring          : 50,132 bytes in 1,037 blocks
==2878348==         suppressed: 0 bytes in 0 blocks

@jroesch, @MarisaKirisame please review.

@MarisaKirisame
Copy link
Contributor

This fix it for this case. I am just in general unfavor of case by case fix, as it will always be incomplete (by rice theorem). I think some cycle detection on top of ref counting will be best and I will talk with @jroesch .

@hlu1
Copy link
Contributor Author

hlu1 commented Jun 27, 2019

I totally agree. This does unblock us from deployment while you guys work on a more proper fix.

@tqchen tqchen merged commit 9b3e83f into apache:master Jun 28, 2019
@tqchen
Copy link
Member

tqchen commented Jun 28, 2019

thanks, @hlu1 @MarisaKirisame , this PR is now merged.

wweic pushed a commit to wweic/tvm that referenced this pull request Jun 28, 2019
wweic pushed a commit to neo-ai/tvm that referenced this pull request Jun 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants