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

DrawableNoise taking up too much memory #1006

Closed
Merudo opened this issue Dec 17, 2019 · 3 comments
Closed

DrawableNoise taking up too much memory #1006

Merudo opened this issue Dec 17, 2019 · 3 comments
Assignees
Labels

Comments

@Merudo
Copy link
Member

Merudo commented Dec 17, 2019

Describe the bug
There has been multiple reports of MapTool using up much more memory since 1.5.7

Reverting commits in batches, I think I've isolated the problem to the DrawableNoise feature (commit 2275f6f).

Each ZoneRenderer stores up a DrawableNoise object, which takes up a lot memory. @Phergus estimated that each noise mask is around 28MB.

To Reproduce
Steps to reproduce the behavior:

  1. Load a campaign with multiple maps.
  2. Record how much memory it is using.
  3. Modify the source code of ZoneRenderer, so that the line
private final DrawableNoise noise = new DrawableNoise();

is replaced by

private final DrawableNoise noise = null;
  1. Run and load the same campaign.
  2. Record how much memory it is using. In my case, it went from 250mb to 100mb.

Expected behavior
Users shouldn't have to pay hundred of mbs in memory if the feature isn't active.

I suggest that noise variable be only constructed once the user activates the noise feature.

MapTool Info

  • Version: 1.5.7+
  • Install: New

Desktop (please complete the following information):

  • OS: Windows
  • Version: 10
@Phergus Phergus added the bug label Dec 17, 2019
@Phergus
Copy link
Contributor

Phergus commented Dec 17, 2019

Probably should have the /tn on and off commands add/remove the drawable noise from the ZoneRenderer.

@sentry-io
Copy link

sentry-io bot commented Dec 17, 2019

Sentry issue: MAPTOOL-2NT

@Phergus Phergus self-assigned this Dec 18, 2019
Phergus added a commit to Phergus/maptool that referenced this issue Dec 18, 2019
DrawableNoise mask set to null and only created if enabled or values set (which enables).  Cuts way back on memory usage and load times for campaigns with multiple maps.  Issue RPTools#1006
@Phergus
Copy link
Contributor

Phergus commented Dec 25, 2019

Closing.

@Phergus Phergus closed this as completed Dec 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants