This CL implements the memory reclaiming function releaseFreeMemoryToOS
and its associated classes. Most of this code was originally written by
Aleksey for the Primary64 in sanitizer_common, and I made some changes to
be able to implement 32-bit reclaiming as well. The code has be restructured
a bit to accomodate for freelist of batches instead of the freearray used
in the current sanitizer_common code.
Details
Diff Detail
- Repository
- rCRT Compiler Runtime
- Build Status
Buildable 31049 Build 31048: arc lint + arc unit
Event Timeline
lib/scudo/standalone/release.h | ||
---|---|---|
20 | Do you need default args here? | |
37 | Initialize everything for consistency? | |
59 | with MSVC 64bit sizeof(~0UL) < sizeof(uptr) or just | |
66 | same for 1UL | |
159 | I think the following way it's more readable and easier to see that UNREACHABLE is not possible if (BlockSize <= PageSize) { if (PageSize % BlockSize == 0) { // Same number of chunks per page, no cross overs. FullPagesBlockCountMax = PageSize / BlockSize; SameBlockCountPerPage = true; } else if (BlockSize % (PageSize % BlockSize) == 0) { // Some chunks are crossing page boundaries, which means that the page // contains one or two partial chunks, but all pages contain the same // number of chunks. FullPagesBlockCountMax = PageSize / BlockSize + 1; SameBlockCountPerPage = true; } else { FullPagesBlockCountMax = PageSize / BlockSize + 2; SameBlockCountPerPage = false; } } else { if (BlockSize % PageSize == 0) { // One chunk covers multiple pages, no cross overs. FullPagesBlockCountMax = 1; SameBlockCountPerPage = true; } else { // One chunk covers multiple pages, Some chunks are crossing page // boundaries. Some pages contain one chunk, some contain two. FullPagesBlockCountMax = 2; SameBlockCountPerPage = false; } } |
Addressing Vitaly's comments.
lib/scudo/standalone/release.h | ||
---|---|---|
20 | Leaving the Data one so that it can constructed without. | |
59 | Done. Sidenote: MSVC support is not in the books for any time soon. | |
66 | That was one of the modifications I made from the initial code. |
Do you need default args here?