summaryrefslogtreecommitdiff
path: root/src/gc
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2016-10-21 22:07:29 -0700
committerGitHub <noreply@github.com>2016-10-21 22:07:29 -0700
commita0ae251eed00dfb5f5dc8dd3769c15c300c7502c (patch)
treedb47090c0f51312bed12dc3e01ad68995f22d70b /src/gc
parent6c7bcaf51c9ed8fdf1253e05429291d56fc56509 (diff)
downloadcoreclr-a0ae251eed00dfb5f5dc8dd3769c15c300c7502c.tar.gz
coreclr-a0ae251eed00dfb5f5dc8dd3769c15c300c7502c.tar.bz2
coreclr-a0ae251eed00dfb5f5dc8dd3769c15c300c7502c.zip
Port GC changes from CoreRT (#7764)
https://github.com/dotnet/corert/pull/2064: Add back limit for maximum object size https://github.com/dotnet/corert/pull/2061: Fix retail build break
Diffstat (limited to 'src/gc')
-rw-r--r--src/gc/gc.cpp18
-rw-r--r--src/gc/gccommon.cpp1
-rw-r--r--src/gc/gcinterface.h8
-rw-r--r--src/gc/sample/gcenv.h2
4 files changed, 11 insertions, 18 deletions
diff --git a/src/gc/gc.cpp b/src/gc/gc.cpp
index 028a9f8a6e..b8c7b7895f 100644
--- a/src/gc/gc.cpp
+++ b/src/gc/gc.cpp
@@ -30487,18 +30487,20 @@ CObjectHeader* gc_heap::allocate_large_object (size_t jsize, int64_t& alloc_byte
#endif //BACKGROUND_GC
#endif // MARK_ARRAY
- // these next few lines are not strictly necessary anymore - they are here
- // to sanity check that we didn't get asked to create an object
- // that's too large.
#if BIT64
- size_t maxObjectSize = (INT64_MAX - 7 - Align(min_obj_size));
+ size_t maxObjectSize = (INT64_MAX - 7 - Align(min_obj_size));
#else
- size_t maxObjectSize = (INT32_MAX - 7 - Align(min_obj_size));
+ size_t maxObjectSize = (INT32_MAX - 7 - Align(min_obj_size));
#endif
- // The VM should have thrown instead of passing us an allocation
- // request that's too large.
- assert(jsize < maxObjectSize);
+ if (jsize >= maxObjectSize)
+ {
+ if (g_pConfig->IsGCBreakOnOOMEnabled())
+ {
+ GCToOSInterface::DebugBreak();
+ }
+ return NULL;
+ }
size_t size = AlignQword (jsize);
int align_const = get_alignment_constant (FALSE);
diff --git a/src/gc/gccommon.cpp b/src/gc/gccommon.cpp
index 3a951ccda3..2e6bfce833 100644
--- a/src/gc/gccommon.cpp
+++ b/src/gc/gccommon.cpp
@@ -156,6 +156,7 @@ IGCHeap* InitializeGarbageCollector(IGCToCLR* clrToGC)
assert(clrToGC != nullptr);
g_theGCToCLR = clrToGC;
#else
+ UNREFERENCED_PARAMETER(clrToGC);
assert(clrToGC == nullptr);
#endif
diff --git a/src/gc/gcinterface.h b/src/gc/gcinterface.h
index d521ddada7..ac14332dcf 100644
--- a/src/gc/gcinterface.h
+++ b/src/gc/gcinterface.h
@@ -393,14 +393,6 @@ public:
Allocation routines. These all call into the GC's allocator and may trigger a garbage
collection. All allocation routines return NULL when the allocation request
couldn't be serviced due to being out of memory.
-
- These allocation routines should not be called with allocation requests
- larger than:
- 32-bit -> 0x7FFFFFE0
- 64-bit -> 0x7FFFFFFFFFFFFFE0
-
- It is up to the caller of the API to raise appropriate errors if the amount
- of requested memory is too large.
===========================================================================
*/
diff --git a/src/gc/sample/gcenv.h b/src/gc/sample/gcenv.h
index 94d6939e9f..4505f1af30 100644
--- a/src/gc/sample/gcenv.h
+++ b/src/gc/sample/gcenv.h
@@ -186,8 +186,6 @@ public:
int GetGCTrimCommit() const { return 0; }
int GetGCLOHCompactionMode() const { return 0; }
- bool GetGCAllowVeryLargeObjects() const { return false; }
-
bool GetGCConservative() const { return true; }
};