-
Notifications
You must be signed in to change notification settings - Fork 160
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
Better Tracking of Amounts of Memory Allocated and Time in the Garbage Collector #1806
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1806 +/- ##
==========================================
+ Coverage 63.04% 63.12% +0.08%
==========================================
Files 969 969
Lines 292297 293004 +707
Branches 12702 12802 +100
==========================================
+ Hits 184275 184959 +684
- Misses 105264 105271 +7
- Partials 2758 2774 +16
|
This is likely to overflow on 32-bit OSes. We could go to the work of changing the If we just let the code overflow, I'd probably change |
2e91efe
to
0acdc68
Compare
src/gasman.c
Outdated
#endif | ||
SizeAllBags += new_size - old_size; | ||
// SizeAllBags += new_size - old_size; |
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.
Why are these two lines commented out, instead of being removed?
Also, the commit message of the second commit is too long, and ends in "ZZ". Perhaps use this instead: "Fix counting of SizeAllBags in ResizeBag, and use memmove" or "ResizeBag: fix counting of SizeAllBags, use memmove"
src/gasman.c
Outdated
@@ -1303,6 +1303,13 @@ UInt ResizeBag ( | |||
YoungBags += diff; | |||
AllocBags += diff; | |||
|
|||
/* In this case we increase the total amount allocated by the | |||
difference */ |
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.
Note that the surrounding code uses //
comments.
It's also not clear to me what "In this case" refers to. Is it "the case we are in right now" (then it's a bit redundant, isn't it?), or is it something else (but what?).
Perhaps: "We enlarged the last bag and hence the total amount allocated, record this" or so?
src/gap.c
Outdated
@@ -148,6 +148,16 @@ UInt Last3; | |||
*/ | |||
UInt Time; | |||
|
|||
/**************************************************************************** | |||
** | |||
*V MemoryAllocated. . . . . . . . . . . global variable 'memory_allocated' |
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.
Add space before first .
, remove extra space after "variable"
lib/string.gd
Outdated
@@ -836,4 +836,13 @@ BindGlobal("BHINT", MakeImm("\>\<")); | |||
|
|||
############################################################################# | |||
## | |||
#F MemoryString( <m> ) returns an appropriate human-readable string | |||
## representation of <m> bytes |
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.
If you asked me what a function named "MemoryString" would do, I am not sure I'd ever have guessed this meaning...
Alas, I don't really have a better idea for a name :/
0acdc68
to
5b00743
Compare
Rebased and addressed at least most of the nitpicks. |
5b00743
to
b803cb0
Compare
also use memmove in one place
These are analogs of Runtime() and time, but for allocated memory.
a function for printing numbers of bytes in a human-friendly format.
b803cb0
to
a896c20
Compare
This PR aims towards better continuous monitoring of garbage production. As other things are being sped up, garbage collection can consume a very large amount of CPU time in some benchmarks and we should pay more attention to optimising our algorithms to minimise garbage production as well as direct CPU use. It adds TotalMemoryAllocated() and memory_allocated which work analagously to Runtime() and time, and also adds monitoring and printing of memory allocation and GC time in TestDirectory. Some minor utilities and cleanup is also included.