Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

GC: fix wrong profile result if more than 4GB used #2599

Merged
merged 1 commit into from
May 6, 2019

Conversation

rainers
Copy link
Member

@rainers rainers commented May 5, 2019

No description provided.

@rainers rainers added the Trivial typos, formatting, comments label May 5, 2019
@dlang-bot
Copy link
Contributor

dlang-bot commented May 5, 2019

Thanks for your pull request, @rainers!

Bugzilla references

Auto-close Bugzilla Severity Description
19847 minor no GC memory above 4GB reported with --DRT-gcopt=profile:1

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub fetch digger
dub run digger -- build "stable + druntime#2599"

@thewilsonator
Copy link
Contributor

Does this have a bugzilla? Also this is so trivial it should go to stable.

@dlang-bot dlang-bot added the Bug Fix Include reference to corresponding bugzilla issue label May 6, 2019
@rainers rainers changed the base branch from master to stable May 6, 2019 07:25
@rainers
Copy link
Member Author

rainers commented May 6, 2019

Added bug report and rebased to stable. A test case is a bit problematic because allocating more than 4GB might be a problem on some CI machines.

@dlang-bot dlang-bot merged commit e4fce9d into dlang:stable May 6, 2019
@thewilsonator
Copy link
Contributor

Thanks!

@jacob-carlborg
Copy link
Contributor

Is it possible to make an artificial test, by somehow manually setting mappedPages to a big value?

@rainers
Copy link
Member Author

rainers commented May 6, 2019

Is it possible to make an artificial test, by somehow manually setting mappedPages to a big value?

Possible, but I think that would be rather invasive for such a trivial fix. It would be nice if the compiler would warn about cases like these, i.e. when the result of a calculation might overflow an int, but the assigned lvalue has larger size (similar for comparisons).

@@ -1596,7 +1596,7 @@ struct Gcx

private @property bool lowMem() const nothrow
{
return isLowOnMem(mappedPages * PAGESIZE);
return isLowOnMem(cast(size_t)mappedPages * PAGESIZE);
Copy link
Member

@PetarKirov PetarKirov Jun 13, 2019

Choose a reason for hiding this comment

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

I wonder if it would be better to instead change the type of the PAGESIZE enum to size_t. That way any arithmetic operation where one of the operands is PAGESIZE would promote the other operand as necessary.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Fix Include reference to corresponding bugzilla issue Trivial typos, formatting, comments
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants