Mercurial > hg > graal-jvmci-8
comparison src/share/vm/services/memTracker.cpp @ 11137:c9a5fab39234
8012241: NMT huge memory footprint, it usually leads to OOME
Summary: Enforce memory limitation on NMT to prevent JVM OOM
Reviewed-by: acorn, dcubed, minqi
author | zgu |
---|---|
date | Thu, 11 Jul 2013 13:15:12 -0400 |
parents | 1f4355cee9a2 |
children | 248c459b2b75 |
comparison
equal
deleted
inserted
replaced
11101:e79a9f26ba2e | 11137:c9a5fab39234 |
---|---|
383 */ | 383 */ |
384 #define MAX_SAFEPOINTS_TO_SKIP 128 | 384 #define MAX_SAFEPOINTS_TO_SKIP 128 |
385 #define SAFE_SEQUENCE_THRESHOLD 30 | 385 #define SAFE_SEQUENCE_THRESHOLD 30 |
386 #define HIGH_GENERATION_THRESHOLD 60 | 386 #define HIGH_GENERATION_THRESHOLD 60 |
387 #define MAX_RECORDER_THREAD_RATIO 30 | 387 #define MAX_RECORDER_THREAD_RATIO 30 |
388 #define MAX_RECORDER_PER_THREAD 100 | |
388 | 389 |
389 void MemTracker::sync() { | 390 void MemTracker::sync() { |
390 assert(_tracking_level > NMT_off, "NMT is not enabled"); | 391 assert(_tracking_level > NMT_off, "NMT is not enabled"); |
391 assert(SafepointSynchronize::is_at_safepoint(), "Safepoint required"); | 392 assert(SafepointSynchronize::is_at_safepoint(), "Safepoint required"); |
392 | 393 |
435 | 436 |
436 // see if NMT has too many outstanding recorder instances, it usually | 437 // see if NMT has too many outstanding recorder instances, it usually |
437 // means that worker thread is lagging behind in processing them. | 438 // means that worker thread is lagging behind in processing them. |
438 if (!AutoShutdownNMT) { | 439 if (!AutoShutdownNMT) { |
439 _slowdown_calling_thread = (MemRecorder::_instance_count > MAX_RECORDER_THREAD_RATIO * _thread_count); | 440 _slowdown_calling_thread = (MemRecorder::_instance_count > MAX_RECORDER_THREAD_RATIO * _thread_count); |
441 } else { | |
442 // If auto shutdown is on, enforce MAX_RECORDER_PER_THREAD threshold to prevent OOM | |
443 if (MemRecorder::_instance_count >= _thread_count * MAX_RECORDER_PER_THREAD) { | |
444 shutdown(NMT_out_of_memory); | |
445 } | |
440 } | 446 } |
441 | 447 |
442 // check _worker_thread with lock to avoid racing condition | 448 // check _worker_thread with lock to avoid racing condition |
443 if (_worker_thread != NULL) { | 449 if (_worker_thread != NULL) { |
444 _worker_thread->at_sync_point(pending_recorders, InstanceKlass::number_of_instance_classes()); | 450 _worker_thread->at_sync_point(pending_recorders, InstanceKlass::number_of_instance_classes()); |