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

UInt64 cannot be negative #56

Closed
frogcjn opened this issue Nov 27, 2015 · 1 comment
Closed

UInt64 cannot be negative #56

frogcjn opened this issue Nov 27, 2015 · 1 comment
Assignees
Milestone

Comments

@frogcjn
Copy link

frogcjn commented Nov 27, 2015

In ImageCache.swift

                let bytesToPurge = self.currentMemoryUsage - self.preferredMemoryUsageAfterPurge

This sentence may EXC_BREAKPOINT, because self.currentMemoryUsage may less then self.preferredMemoryUsageAfterPurge.

and bytesToPruge is UInt64 type inference by Swift.

@cnoon cnoon self-assigned this Dec 10, 2015
@cnoon
Copy link
Member

cnoon commented Dec 10, 2015

Thanks for reporting @frogcjn!

I would say that if you end up seeing this error, then you have set up the memoryCapacity and the preferredMemoryUsageAfterPurge parameters incorrectly. To help guard against this moving forward, I've added a precondition to the ImageCache initializer in 0095691 to prevent you from accidentally making this mistake.

Thanks again. 🍻

@cnoon cnoon closed this as completed Dec 10, 2015
@cnoon cnoon added this to the 2.2.0 milestone Dec 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants