snazzy-d / sdc

The Snazzy D Compiler
MIT License
250 stars 55 forks source link

Base.purgeAddressSpace() via madvise() #336

Closed dsm9000 closed 11 months ago

dsm9000 commented 1 year ago

Split from https://github.com/snazzy-d/sdc/pull/335 , but does not depend on it.

This feature permits the purging of an arbitrary run of dirty pages, rendering it clean, as requested in https://github.com/snazzy-d/sdc/issues/270 .

Uses the "lazy" madvise operation MADV_FREE on Linux (where supported) and the equiv. but eager MADV_DONTNEED operation on all other supported platforms.

AFAIK not feasible to unit test, as the OS provides no immediate confirmation of the effects of madvise.

Required by https://github.com/snazzy-d/sdc/pull/337 .