comparison src/share/vm/services/memTracker.hpp @ 10096:35f8765422b9

8010151: nsk/regression/b6653214 fails "assert(snapshot != NULL) failed: Worker should not be started" Summary: Fixed a racing condition when shutting down NMT while worker thread is being started, also fixed a few mis-declared volatile pointers. Reviewed-by: dholmes, dlong
author zgu
date Wed, 10 Apr 2013 08:55:50 -0400
parents b5bae74160b7
children 1f4355cee9a2
comparison
equal deleted inserted replaced
9066:09b0d3e9ba6c 10096:35f8765422b9
419 NOT_PRODUCT(static void print_tracker_stats(outputStream* st);) 419 NOT_PRODUCT(static void print_tracker_stats(outputStream* st);)
420 NOT_PRODUCT(static void walk_stack(int toSkip, char* buf, int len);) 420 NOT_PRODUCT(static void walk_stack(int toSkip, char* buf, int len);)
421 421
422 private: 422 private:
423 // start native memory tracking worker thread 423 // start native memory tracking worker thread
424 static bool start_worker(); 424 static bool start_worker(MemSnapshot* snapshot);
425 425
426 // called by worker thread to complete shutdown process 426 // called by worker thread to complete shutdown process
427 static void final_shutdown(); 427 static void final_shutdown();
428 428
429 protected: 429 protected:
473 static Mutex* _query_lock; 473 static Mutex* _query_lock;
474 474
475 // a thread can start to allocate memory before it is attached 475 // a thread can start to allocate memory before it is attached
476 // to VM 'Thread', those memory activities are recorded here. 476 // to VM 'Thread', those memory activities are recorded here.
477 // ThreadCritical is required to guard this global recorder. 477 // ThreadCritical is required to guard this global recorder.
478 static MemRecorder* _global_recorder; 478 static MemRecorder* volatile _global_recorder;
479 479
480 // main thread id 480 // main thread id
481 debug_only(static intx _main_thread_tid;) 481 debug_only(static intx _main_thread_tid;)
482 482
483 // pending recorders to be merged 483 // pending recorders to be merged
484 static volatile MemRecorder* _merge_pending_queue; 484 static MemRecorder* volatile _merge_pending_queue;
485 485
486 NOT_PRODUCT(static volatile jint _pending_recorder_count;) 486 NOT_PRODUCT(static volatile jint _pending_recorder_count;)
487 487
488 // pooled memory recorders 488 // pooled memory recorders
489 static volatile MemRecorder* _pooled_recorders; 489 static MemRecorder* volatile _pooled_recorders;
490 490
491 // memory recorder pool management, uses following 491 // memory recorder pool management, uses following
492 // counter to determine if a released memory recorder 492 // counter to determine if a released memory recorder
493 // should be pooled 493 // should be pooled
494 494