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

Power of Two cached arrays only #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Power of Two cached arrays only #3

wants to merge 1 commit into from

Conversation

thygrrr
Copy link
Contributor

@thygrrr thygrrr commented Oct 5, 2018

Changed ArrayPool so it will only work with Power of Two arrays. There are various questions that remain, including whether the mod as it is will work with this. Feeding the arrays given to compress into the cache, however, constitutes a memory leak; and if anyone who called compress reuses this array, this causes undefined corruption.

Fixes:

  • correct powers of two used (was a +1 error, and very bad effects for negative values)
  • tests adapted
  • new tests to prove we are actually recycling arrays

Last question:

…e are various questions that remain, including whether the game will work with this. Feeding the arrays given to compress into the cache, however, constitutes a memory leak; and if anyone who called compress reuses this array, this causes undefined corruption.
@@ -35,32 +36,10 @@ public void CompressData_NoIssues()
}

[TestMethod]
public void CompressDataReuseArrays()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to write a adapted version of this test, but it wouldn't work.

@thygrrr
Copy link
Contributor Author

thygrrr commented Oct 5, 2018

I don't think this should be merged. :( 👎 At least not before I find out why compress suddenly needs memory.

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

Successfully merging this pull request may close these issues.

1 participant