src/share/vm/services/memTracker.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/services

src/share/vm/services/memTracker.cpp

Print this page




  60 #else
  61       level = NMT_summary;
  62 #endif // PLATFORM_NATIVE_STACK_WALKING_SUPPORTED
  63     } else if (strcmp(nmt_option, "off") != 0) {
  64       // The option value is invalid
  65       _is_nmt_env_valid = false;
  66     }
  67 
  68     // Remove the environment variable to avoid leaking to child processes
  69     os::unsetenv(buf);
  70   }
  71 
  72   if (!MallocTracker::initialize(level) ||
  73       !VirtualMemoryTracker::initialize(level)) {
  74     level = NMT_off;
  75   }
  76   return level;
  77 }
  78 
  79 void MemTracker::init() {
  80   if (tracking_level() >= NMT_summary) {





  81     _query_lock = new (std::nothrow) Mutex(Monitor::max_nonleaf, "NMT_queryLock");
  82     // Already OOM. It is unlikely, but still have to handle it.
  83     if (_query_lock == NULL) {
  84       shutdown();
  85     }
  86   }
  87 }
  88 
  89 bool MemTracker::check_launcher_nmt_support(const char* value) {
  90   if (strcmp(value, "=detail") == 0) {
  91 #if !PLATFORM_NATIVE_STACK_WALKING_SUPPORTED
  92       jio_fprintf(defaultStream::error_stream(),
  93         "NMT detail is not supported on this platform.  Using NMT summary instead.\n");
  94     if (MemTracker::tracking_level() != NMT_summary) {
  95     return false;
  96   }
  97 #else
  98     if (MemTracker::tracking_level() != NMT_detail) {
  99       return false;
 100     }




  60 #else
  61       level = NMT_summary;
  62 #endif // PLATFORM_NATIVE_STACK_WALKING_SUPPORTED
  63     } else if (strcmp(nmt_option, "off") != 0) {
  64       // The option value is invalid
  65       _is_nmt_env_valid = false;
  66     }
  67 
  68     // Remove the environment variable to avoid leaking to child processes
  69     os::unsetenv(buf);
  70   }
  71 
  72   if (!MallocTracker::initialize(level) ||
  73       !VirtualMemoryTracker::initialize(level)) {
  74     level = NMT_off;
  75   }
  76   return level;
  77 }
  78 
  79 void MemTracker::init() {
  80   NMT_TrackingLevel level = tracking_level();
  81   if (level >= NMT_summary) {
  82     if (!VirtualMemoryTracker::late_initialize(level)) {
  83       shutdown();
  84       return;
  85     }
  86     _query_lock = new (std::nothrow) Mutex(Monitor::max_nonleaf, "NMT_queryLock");
  87     // Already OOM. It is unlikely, but still have to handle it.
  88     if (_query_lock == NULL) {
  89       shutdown();
  90     }
  91   }
  92 }
  93 
  94 bool MemTracker::check_launcher_nmt_support(const char* value) {
  95   if (strcmp(value, "=detail") == 0) {
  96 #if !PLATFORM_NATIVE_STACK_WALKING_SUPPORTED
  97       jio_fprintf(defaultStream::error_stream(),
  98         "NMT detail is not supported on this platform.  Using NMT summary instead.\n");
  99     if (MemTracker::tracking_level() != NMT_summary) {
 100     return false;
 101   }
 102 #else
 103     if (MemTracker::tracking_level() != NMT_detail) {
 104       return false;
 105     }


src/share/vm/services/memTracker.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File