[scudo][standalone] Add the memory reclaiming mechanism

Authored by cryptoad on Apr 30 2019, 7:56 AM.


[scudo][standalone] Add the memory reclaiming mechanism

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.

Reviewers: eugenis, vitalybuka, morehouse, hctim

Reviewed By: vitalybuka

Subscribers: srhines, mgorny, delcypher, #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

Differential Revision: https://reviews.llvm.org/D61214

llvm-svn: 359567