-
-
Notifications
You must be signed in to change notification settings - Fork 424
GC: fix wrong profile result if more than 4GB used #2599
Conversation
Thanks for your pull request, @rainers! Bugzilla references
Testing this PR locallyIf 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" |
Does this have a bugzilla? Also this is so trivial it should go to stable. |
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. |
Thanks! |
Is it possible to make an artificial test, by somehow manually setting |
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); |
There was a problem hiding this comment.
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.
No description provided.