[sgen] Fixes for max-heap-size option (mono/mono#18446)
authorVlad Brezae <brezaevlad@gmail.com>
Tue, 14 Jan 2020 19:42:14 +0000 (11:42 -0800)
committerGitHub <noreply@github.com>
Tue, 14 Jan 2020 19:42:14 +0000 (11:42 -0800)
commitc8d03fbd171f70c3aadc1010df59b95594a00fa4
treee8f405327db595371f6758c610b1f17b7e0d2f96
parent422e74ea8c722eaab6ec5e8c365a215da46b20c1
[sgen] Fixes for max-heap-size option (mono/mono#18446)

* [sgen] Don't subtract twice the nursery size from max_heap_size

We were subtracting the nursery size when initializing max_heap_size as well as adding it to the allocated_heap when allocating the nursery (alloc_nursery).

* [sgen] Trigger collection if failing to allocate los section

If the memory governor says we are exceeding the max_heap_size by allocating a los section (1MB) for a new los object, attempt to clear some space by triggering a major collection, before completely bailing out.

Commit migrated from https://github.com/mono/mono/commit/d9db79b4b281afc5064921ff69a4bbbfb2c5f0e1
src/mono/mono/sgen/sgen-los.c
src/mono/mono/sgen/sgen-memory-governor.c