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

Memory Leak #123

Open
MatthiasJ1 opened this issue Nov 25, 2024 · 3 comments
Open

Memory Leak #123

MatthiasJ1 opened this issue Nov 25, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@MatthiasJ1
Copy link

The longer the viewer runs, the more RAM it uses and the slower it renders. To reproduce this issue, create a loop that changes a small scene repeatedly and call view_all() in each iteration. The performance will degrade over time and RAM will increase indefinitely. In my test, rendering this animation for 3 minutes increased the RAM usage to 7GB.

out.mp4
@MatthiasJ1
Copy link
Author

This behavior is the same in VSCode or standalone and exists in the viewer server (although I have not explicitly checked if this problem exists on the CAD script side as in my case this typically becomes and issue over multiple runs rather than a single long run)

@bernhard-42 bernhard-42 added the bug Something isn't working label Nov 26, 2024
@bernhard-42
Copy link
Owner

How do you create this loop?
Do you use the animation feature?
Or simply draw "frame after frame" and screenshot it.
I don't really know how javascripts garbage collector works or how I can profile a web app in the browser. Need to find out to see whether the issue is on my code (most probably) or in threejs (the only dependency of the viewer)

@MatthiasJ1
Copy link
Author

p = JernArc((0,0), (1,0), 10, 180).edge()
s = Circle(3)
t = 0
while True:
    t = max(0.01, (t+0.01)%1)
    o = sweep((p^0)*s, p.trim(0, t))
    show_all()

Also, you may notice that the object flashes which is caused by the lighting changing when first drawing the object, then it is re-rendered with the correct lighting. The flashing is obviously a bug but it is also rendering the scene twice unnecessarily.

Screen_Recording.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants