This repository was archived by the owner on Jan 23, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +29
-1
lines changed Expand file tree Collapse file tree 1 file changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -15882,14 +15882,42 @@ start_no_gc_region_status gc_heap::prepare_for_no_gc_region (uint64_t total_size
1588215882 save_data_for_no_gc();
1588315883 settings.pause_mode = pause_no_gc;
1588415884 current_no_gc_region_info.start_status = start_no_gc_success;
15885-
15885+
1588615886 size_t allocation_no_gc_loh = 0;
1588715887 size_t allocation_no_gc_soh = 0;
1588815888 size_t size_per_heap = 0;
1588915889
15890+ // requested sizes of 0 make no sense.
15891+ if (total_size == 0)
15892+ {
15893+ status = start_no_gc_too_large;
15894+ goto done;
15895+ }
15896+
15897+ if (loh_size_known)
15898+ {
15899+ if (loh_size == 0)
15900+ {
15901+ status = start_no_gc_too_large;
15902+ goto done;
15903+ }
15904+
15905+ // According to the documentation, TryStartNoGCRegion must fail if
15906+ // it can't allocate total_size - loh_size for the SOH. This only makes
15907+ // any kind of sense if total_size > loh_size.
15908+ if ((total_size - loh_size) > total_size)
15909+ {
15910+ status = start_no_gc_too_large;
15911+ goto done;
15912+ }
15913+ }
15914+
15915+ assert(total_size != 0);
1589015916 total_size = (size_t)((float)total_size * 1.05);
1589115917 if (loh_size_known)
1589215918 {
15919+ assert(loh_size != 0);
15920+ assert(total_size >= loh_size);
1589315921 loh_size = (size_t)((float)loh_size * 1.05);
1589415922 allocation_no_gc_loh = (size_t)loh_size;
1589515923 allocation_no_gc_soh = (size_t)(total_size - loh_size);
You can’t perform that action at this time.
0 commit comments