#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);
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.
===========================================================================
*/
int GetGCTrimCommit() const { return 0; }
int GetGCLOHCompactionMode() const { return 0; }
- bool GetGCAllowVeryLargeObjects() const { return false; }
-
bool GetGCConservative() const { return true; }
};