141 if (UseTLAB) {
142 result = allocate_from_tlab(klass, THREAD, size);
143 if (result != NULL) {
144 assert(!HAS_PENDING_EXCEPTION,
145 "Unexpected exception, will result in uninitialized storage");
146 return result;
147 }
148 }
149 bool gc_overhead_limit_was_exceeded = false;
150 result = Universe::heap()->mem_allocate(size,
151 &gc_overhead_limit_was_exceeded);
152 if (result != NULL) {
153 NOT_PRODUCT(Universe::heap()->
154 check_for_non_bad_heap_word_value(result, size));
155 assert(!HAS_PENDING_EXCEPTION,
156 "Unexpected exception, will result in uninitialized storage");
157 THREAD->incr_allocated_bytes(size * HeapWordSize);
158
159 AllocTracer::send_allocation_outside_tlab(klass, result, size * HeapWordSize, THREAD);
160
161 THREAD->tlab().handle_sample(THREAD, result, size);
162 return result;
163 }
164
165
166 if (!gc_overhead_limit_was_exceeded) {
167 // -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support
168 report_java_out_of_memory("Java heap space");
169
170 if (JvmtiExport::should_post_resource_exhausted()) {
171 JvmtiExport::post_resource_exhausted(
172 JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR | JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP,
173 "Java heap space");
174 }
175
176 THROW_OOP_0(Universe::out_of_memory_error_java_heap());
177 } else {
178 // -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support
179 report_java_out_of_memory("GC overhead limit exceeded");
180
181 if (JvmtiExport::should_post_resource_exhausted()) {
|
141 if (UseTLAB) {
142 result = allocate_from_tlab(klass, THREAD, size);
143 if (result != NULL) {
144 assert(!HAS_PENDING_EXCEPTION,
145 "Unexpected exception, will result in uninitialized storage");
146 return result;
147 }
148 }
149 bool gc_overhead_limit_was_exceeded = false;
150 result = Universe::heap()->mem_allocate(size,
151 &gc_overhead_limit_was_exceeded);
152 if (result != NULL) {
153 NOT_PRODUCT(Universe::heap()->
154 check_for_non_bad_heap_word_value(result, size));
155 assert(!HAS_PENDING_EXCEPTION,
156 "Unexpected exception, will result in uninitialized storage");
157 THREAD->incr_allocated_bytes(size * HeapWordSize);
158
159 AllocTracer::send_allocation_outside_tlab(klass, result, size * HeapWordSize, THREAD);
160
161 if (UseTLAB) {
162 THREAD->tlab().handle_sample(THREAD, result, size);
163 }
164 return result;
165 }
166
167
168 if (!gc_overhead_limit_was_exceeded) {
169 // -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support
170 report_java_out_of_memory("Java heap space");
171
172 if (JvmtiExport::should_post_resource_exhausted()) {
173 JvmtiExport::post_resource_exhausted(
174 JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR | JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP,
175 "Java heap space");
176 }
177
178 THROW_OOP_0(Universe::out_of_memory_error_java_heap());
179 } else {
180 // -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support
181 report_java_out_of_memory("GC overhead limit exceeded");
182
183 if (JvmtiExport::should_post_resource_exhausted()) {
|