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

Huge client memory leak in latest green and dev builds #187

Closed
GibbousWaximus opened this issue Jul 18, 2013 · 17 comments
Closed

Huge client memory leak in latest green and dev builds #187

GibbousWaximus opened this issue Jul 18, 2013 · 17 comments

Comments

@GibbousWaximus
Copy link

I think you have a client side memory leak. I recently updated to the latest recommended UE mod builds. I started seeing garbage collection pauses within 30 minutes of playing. I used VisualVM to profile minecraft and found the following:

With Mekanism installed, instances of various classes, but primarily 'net.minecraft.client.model.PositionTextureVertex' rapidly increase over time.

WITHOUT Mekanism installed, instances of that class start and stayed around 308,000 over the course of around 10 minutes play time.
WITH Mekanism installed, instances started at around 308,000, then within 5 minutes ballooned to over 2 million, and just kept climbing, using more and more ram until Minecraft ground to a halt after about 45 minutes because it was doing GC so often.

I've tested this on two pc's and seen the same behavior.
Tested on Mekanism 121, and 123.

@unpairedbracket
Copy link
Collaborator

Oh dear. I don't immediately know why this is happening but I have a feeling it's something I did recently. Which is the most recent build you've used which didn't have this issue?

@GibbousWaximus
Copy link
Author

Prior to updating, we were on Mekanism 103

@unpairedbracket
Copy link
Collaborator

OK, I'll see if I can reproduce the problem, and pinpoint when it started.

@unpairedbracket
Copy link
Collaborator

Well this is odd. The only time I'm seeing increases in PositionTextureVertex on Mekanism 123 is when I have the inventory screen open with NEI's side panel active. It doesn't increase as dramatically as what you describe and some (not all) of the increase seems to be GCed when I close the inventory again

@GibbousWaximus
Copy link
Author

I'm currently profiling minecraft and sampling memory usage with VisualVM. In minecraft, I am just standing in a mekanism machine room, with the debug screen up and the chat box open.

Here's a snapshot from near the top of it's cycle before GC runs. It's been running about 10 minutes and is getting to around ~55% peak used memory in minecraft with 2G allocated, and the peak memory used is slowly going up.

1

@unpairedbracket
Copy link
Collaborator

That is bad, I'll see if I can work out from the source what might be instantiating all those instances. Maybe that'll be more successful.

@unpairedbracket
Copy link
Collaborator

My guess is that one of the machines that uses a special renderer is doing something dodgy, creating lots of new render models and keeping them around somehow so they can't be garbage-collected. There are rather a lot of those machines, could you let me know which special-rendered ones you have in your machine room?

@GibbousWaximus
Copy link
Author

I'm not familiar with what a special rendered machine would be. Could you explain that for me?

@unpairedbracket
Copy link
Collaborator

Anything that doesn't render as a normal cube. Metallurgic infuser, hydrogen generator, advanced solar generator, that sort of thing. I think that's why NEI was causing the issue for me, the special-rendered blocks were rendering in the side panel, but they weren't in the world.

@GibbousWaximus
Copy link
Author

In that area is a metallurgic infuser, wire mill, advanced solar generators, wind turbines, hydrogen generator, electrolytic seperators, and a ton of universal cabling. I think thats all from mekanism. There's a variety of special rendered blocks from other mods in the area as well, in case it's relevant, from mffs and atomic science.

I can get a copy of the map and go through and remove stuff 1 at a time while profiling and see what the result is, but I'm not going to have time until Monday, probably.

@unpairedbracket
Copy link
Collaborator

I think I've narrowed it down. Electric Chests cause a small increase in PositionTextureVertex while in the inventory (but not in the world). This increase does appear to be garbage collected quite effectively. BioGenerators while in the inventory or the world cause a rapid increase, as you describe, and it does not get garbage collected. I've managed to get 2 million instances of PositionTextureVertex very quickly by placing 24 BioGens in the world and I'm sure it would have carried on climbing if I hadn't got rid of them. If you have any, try removing them and hiding them in a chest or something and see what happens. I'll see if I can get any other blocks to cause the increase in the world, those were the only two that did in my inventory.

@GibbousWaximus
Copy link
Author

It definitely happens with bio generators. It also definitely happens with
heat generators. I don't know what else (if anything) yet.

On Fri, Jul 19, 2013 at 11:46 AM, Ben Spiers notifications@github.comwrote:

I think I've narrowed it down. Electric Chests cause a small increase in
PositionTextureVertex while in the inventory (but not in the world). This
increase does appear to be garbage collected quite effectively.
BioGenerators while in the inventory or the world cause a rapid increase,
as you describe, and it does not get garbage collected. I've managed to get
2 million instances of PositionTextureVertex very quickly by placing 24
BioGens in the world and I'm sure it would have carried on climbing if I
hadn't got rid of them. If you have any, try removing them and hiding them
in a chest or something and see what happens. I'll see if I can get any
other blocks to cause the increase in the world, those were the only two
that did in my inventory.


Reply to this email directly or view it on GitHubhttps://github.com//issues/187#issuecomment-21261745
.

@unpairedbracket
Copy link
Collaborator

OK, thanks. I'll take a look at that too. The BioGen problem was that it was creating the little moving part every time it rendered. Every time it created it, it was being added to a list and the multiple instances were never removed. I saw a single model that thought it contained 425 boxes after about 20 seconds.

@unpairedbracket
Copy link
Collaborator

I think I've fixed the BioGen and Electric Chest leaks. I've not been able to reproduce any kind of memory leak with Heat Generators in my dev environment, or find anything in the rendering code that would cause such a leak but I'll try with the normal client and see if I can coax any leaks out of it. Try 124 when you're able to and see if that fixes or helps the problem.

@GibbousWaximus
Copy link
Author

I got a chance to briefly test build 124 yesterday and it looks like the
memory leak is fixed.

On Fri, Jul 19, 2013 at 2:26 PM, Ben Spiers notifications@github.comwrote:

I think I've fixed the BioGen and Electric Chest leaks. I've not been able
to reproduce any kind of memory leak with Heat Generators in my dev
environment, or find anything in the rendering code that would cause such a
leak but I'll try with the normal client and see if I can coax any leaks
out of it. Try 124 when you're able to and see if that fixes or helps the
problem.


Reply to this email directly or view it on GitHubhttps://github.com//issues/187#issuecomment-21271741
.

@unpairedbracket
Copy link
Collaborator

Yay!

@DarrenBellew
Copy link

This is still happening

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants