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

Convex Hulls cause a memory leak #1291

Closed
ProbablePrime opened this issue Feb 3, 2024 · 16 comments
Closed

Convex Hulls cause a memory leak #1291

ProbablePrime opened this issue Feb 3, 2024 · 16 comments
Labels
bug Something isn't working as intended.

Comments

@ProbablePrime
Copy link
Member

ProbablePrime commented Feb 3, 2024

Describe the bug?

Using convex hulls causes a memory leak

To Reproduce

  1. Create a new world
  2. Spawn out a convex hull brush
  3. Draw 5 or so Convex Hulls
  4. Watch your memory use sky rocket

Expected behavior

Convex Hulls should perform normally.

Screenshots

No response

Resonite Version Number

2024.2.2.906

What Platforms does this occur on?

Windows, Linux

What headset if any do you use?

Index

Log Files

ALFRED - 2024.2.2.1015 - 2024-02-02 23_39_36.log

Additional Context

Worlds that use a lot of convex hulls are currently death traps. To avoid some trolling I will not list any but have provided a list in the internal team discord.

Panda also experienced this in just deleting convex hulls.

This might be the same issue as: #1290 or 1290 might be separate Charlie was participating in helping me reproduce but the issue looked different so I kept them as two items.

A video from Panda is here: https://cdn.discordapp.com/attachments/850883244501368855/1203246881379979274/Funny_Leak_Cause_Convex_Hulls.mp4

Reporters

So many people jumped in to verify this. Medra was the one who DM'ed me, but the others listed below helped reproduce, diagnose or just experienced the issue in the Resonite Down Under server.

Medra, ProbablePrime, Panda, Bredo, Sveken, Charlie-san, Beef, Unintentional, Canadian_RedZ, ocelot342

@ProbablePrime ProbablePrime added the bug Something isn't working as intended. label Feb 3, 2024
@ProbablePrime
Copy link
Member Author

This is likely some sort of weird side effect of this change:
image

From the 2024.2.2.906 update.

@LeCloutPanda
Copy link

Here is my log file incase you need more logs in the future: GEOFF - 2024.2.2.1015 - 2024-02-03 18_49_01.log

@Canadian-RedZ
Copy link

Here is my log files also
Windows -> REDZ-LENOVO - 2024.2.2.1015 - 2024-02-03 02_31_29.log
Debian/Linux -> RedZ-Lenovo_-2024.2.2.1015-_2024-02-03_03_13_10.log

@Frooxius
Copy link
Member

Frooxius commented Feb 3, 2024

We'll have to report this to author of BepuPhysicsV2, it's probably the code not clearing up some memory it allocates, so it accumulates on repeated runs.

If anybody wants to have a look at the backported code before I get to it, it's here: Yellow-Dog-Man/bepuphysics2@64795ac

@Banane9
Copy link

Banane9 commented Feb 3, 2024

This is likely some sort of weird side effect of this change:

I'm not sure about it being completely new - this could explain what happened about two weeks ago, where I got up to some very spicy RAM usage that also went up pretty fast 🤔

Task Manager showing Resonite with 45GB RAM used

Here's a log in any case (puush because GitHub only allows 25MB and this was at the end of a long session I was hosting, where convex hull brushes came out at some point to show them off to new people):
https://puu.sh/K0ae6/346bdf5626.log

@Frooxius
Copy link
Member

Frooxius commented Feb 3, 2024

Is there a way to confirm that the leak before was also due to convex hulls specifically?

They can happen for a number of reasons, so I don't want us going down a wrong rabbit hole.

@Banane9
Copy link

Banane9 commented Feb 3, 2024

Is there a way to confirm that the leak before was also due to convex hulls specifically?

Not specifically - it just reminded me of that occasion and I wanted to provide the log just in case it does have anything relevant.

@Frooxius
Copy link
Member

Frooxius commented Feb 3, 2024

Would anyone be able to jump on an older build (I think one in the pre-release might work) and see if this can be replicated with old BepuPhysicsV2 too?

That way we'd know that we have to look for source of this issue outside of the changed code.

@LeCloutPanda
Copy link

Is there a way to confirm that the leak before was also due to convex hulls specifically?

They can happen for a number of reasons, so I don't want us going down a wrong rabbit hole.

If you look at the video I provided to Prime it shows the leak is due to convex hulls because I used the bruh to cause the leak.

@Banane9
Copy link

Banane9 commented Feb 3, 2024

If you look at the video I provided to Prime it shows the leak is due to convex hulls because I used the bruh to cause the leak.

Pretty sure Froox was just replying to my comment about it potentially happening before the update as well.

@LeCloutPanda
Copy link

If you look at the video I provided to Prime it shows the leak is due to convex hulls because I used the bruh to cause the leak.

Pretty sure Froox was just replying to my comment about it potentially happening before the update as well.

My bad you are most likely correct, I have an archived build from pre-release when I got access to the game as a mentor so I'll do more testing and note my findings when I do some testing.

@Canadian-RedZ
Copy link

Would anyone be able to jump on an older build (I think one in the pre-release might work) and see if this can be replicated with old BepuPhysicsV2 too?

That way we'd know that we have to look for source of this issue outside of the changed code.

Here is a test done with Steam's pre-release build 2024.1.21.825
-> https://github.com/Yellow-Dog-Man/Resonite-Issues/assets/20827894/c85f2280-75e0-40b6-bf70-2942f0191ffb
Here is the log from the same test -> REDZ-LENOVO - 2024.1.21.825 - 2024-02-03 11_14_03.log

@Nutcake
Copy link

Nutcake commented Feb 3, 2024

We'll have to report this to author of BepuPhysicsV2, it's probably the code not clearing up some memory it allocates, so it accumulates on repeated runs.

If anybody wants to have a look at the backported code before I get to it, it's here: Yellow-Dog-Man/bepuphysics2@64795ac

It looks like when merging in the changes from upstream you accidentally left in a debug struct called DebugStep, which balloons up with huge amounts of data but has zero actual use beyond troubleshooting.
I've created a PR on your fork of BEPU that reverts that part back to upstream, fixing the issue: Yellow-Dog-Man/bepuphysics2#3

@bredo228
Copy link

bredo228 commented Feb 3, 2024

Did a comparison of Build 2024.1.19.687 and Build 2024.2.2.1015

2024.1.19.687:

DYSNOMIA - 2024.1.19.687 - 2024-02-04 10_15_14.log

convex.hull.build.2024.1.19.687.mp4

2024.2.2.1015:

DYSNOMIA - 2024.2.2.1015 - 2024-02-04 10_18_39.log

2024.2.2.1015.convex.hull.mp4

@ProbablePrime
Copy link
Member Author

Thank you all for the work!

It does look like: Yellow-Dog-Man/bepuphysics2#3

Will fix us up.

@Frooxius
Copy link
Member

Frooxius commented Feb 5, 2024

This has been merged in 2024.2.5.848, thank you!

@Frooxius Frooxius closed this as completed Feb 5, 2024
@shiftyscales shiftyscales removed their assignment Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as intended.
Projects
None yet
Development

No branches or pull requests

8 participants