• Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads


Total Views
On Slideshare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide


  • 1. -XX:+UseSerialGC rough memos
  • 2. minor gc で eden/from から to に copy する辺りのスタックトレースDefNewGeneration::copy_to_survivor_space(oopDesc*) ()FastScanClosure::do_oop(oopDesc**) ()Universe::oops_do(OopClosure*, bool) ()SharedHeap::process_strong_roots(bool, bool, SharedHeap::ScanningOption, OopClosure*, CodeBlobClosure*, OopsInGenClosure*) ()GenCollectedHeap::gen_process_strong_roots(int, bool, bool, bool,SharedHeap::ScanningOption, OopsInGenClosure*, bool,OopsInGenClosure*) ()DefNewGeneration::collect(bool, bool, unsigned int, bool) ()GenCollectedHeap::do_collection(bool, bool, unsigned int, bool, int) ()GenCollectorPolicy::satisfy_failed_allocation(unsigned int, bool) ()GenCollectedHeap::satisfy_failed_allocation(unsigned int, bool) ()VM_GenCollectForAllocation::doit() ()VM_Operation::evaluate() ()VMThread::evaluate_operation(VM_Operation*) ()VMThread::loop() ()VMThread::run() ()java_start(Thread*) ()
  • 3. Java heap からのメモリ取得に失敗し、VMThread に GC を依頼したスレッド。GC 終了まで待つ。#1 0x00ddd48c in pthread_cond_wait@@GLIBC_2.3.2 ()#2 0x01310524 in os::PlatformEvent::park() ()#3 0x012e80f8 in Monitor::IWait(Thread*, long long) ()#4 0x012e88c3 in Monitor::wait(bool, long, bool) ()#5 0x0144a064 in VMThread::execute(VM_Operation*) ()#6 0x010396ef in GenCollectorPolicy::mem_allocate_work(unsigned int, bool, bool*) ()#7 0x0110f83c in GenCollectedHeap::mem_allocate(unsigned int, bool, bool, bool*) ()#8 0x0114c379 in instanceKlass::allocate_instance(Thread*) ()#9 0x0137a0c5 in OptoRuntime::new_instance_C(klassOopDesc*, JavaThread*) ()#10 0xb489d909 in ?? ()#11 0x00000000 in ?? ()
  • 4. void DefNewGeneration::collect(bool full, bool clear_all_soft_refs, size_t size, bool is_tlab) {:age_table clearto clear:gch->gen_process_strong_rootsevacuate_followers.do_voidif !promotion_failed eden clear from clear : swap_spaces _tenuring_threshold = ...else : swap-spaces gch->set_incremental_collection_will_fail _next_gen->promotion_failure_occurred
  • 5. Full GC の最中のスタックトレースGenMarkSweep::mark_sweep_phase4() ()GenMarkSweep::invoke_at_safepoint(int, ReferenceProcessor*, bool) ()OneContigSpaceCardGeneration::collect(bool, bool, unsigned int, bool) ()TenuredGeneration::collect(bool, bool, unsigned int, bool) ()GenCollectedHeap::do_collection(bool, bool, unsigned int, bool, int) ()GenCollectorPolicy::satisfy_failed_allocation(unsigned int, bool) ()GenCollectedHeap::satisfy_failed_allocation(unsigned int, bool) ()VM_GenCollectForAllocation::doit() ()VM_Operation::evaluate() ()VMThread::evaluate_operation(VM_Operation*) ()VMThread::loop() ()VMThread::run() ()
  • 6. void TenuredGeneration::collect(bool full, bool clear_all_soft_refs, size_t size, bool is_tlab) { retire_alloc_buffers_before_full_gc OneContigSpaceCardGeneration::collect(full, clear_all_soft_refs, size, is_tlab)}void OneContigSpaceCardGeneration::collect(bool full, bool clear_all_soft_refs, size_t size, bool is_tlab) { SpecializationStats clear(); ... GenMarkSweep::invoke_at_safepoint(_level, ref_processor(), clear_all_soft_refs); ...}
  • 7. void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp, boolclear_all_softrefs) : mark_sweep_phase1 mark_sweep_phase2 mark_sweep_phase3 mark_sweep_phase4
  • 8. void GenMarkSweep::mark_sweep_phase1(int level, bool clear_all_softrefs) { : GenCollectedHeap* gch = GenCollectedHeap::heap(); : gch->gen_process_strong_roots(level, false, // Younger gens are not roots. true, // activate StrongRootsScope true, // Collecting permanent generation. SharedHeap::SO_SystemClasses, &follow_root_closure, true, // walk code active on stacks &follow_root_closure);
  • 9. java class をあらわすデータ構造 method area (perm) にある。class instanceKlass klassOopDesc 0x9c falsefield instanceKlass _array_klasses 0 4 klassOopfield instanceKlass _methods 4 4 objArrayOop:field instanceKlass _fields 0x14 4 typeArrayOopfield instanceKlass _constants 0x18 4 constantPoolOopfield instanceKlass _class_loader 0x1c 4 oopfield instanceKlass _protection_domain 0x20 4 oopfield instanceKlass _signers 0x24 4 objArrayOopfield instanceKlass _source_file_name 0x28 4 symbolOopfield instanceKlass _inner_classes 0x30 4 typeArrayOopfield instanceKlass _implementor 0x34 4 klassOopfield instanceKlass _generic_signature 0x38 4 symbolOopfield instanceKlass _class_annotations 0x3c 4 typeArrayOopfield instanceKlass _fields_annotations 0x40 4 objArrayOopfield instanceKlass _methods_annotations 0x44 4 objArrayOopfield instanceKlass _methods_parameter_annotations 0x48 4 objArrayOopfield instanceKlass _methods_default_annotations 0x4c 4 objArrayOop
  • 10. *Klass 系の物の先頭にある部分class Klass Klass_vtbl 0x54 truefield Klass _super_check_offset 0 4 juint:field Klass _primary_supers 0xc 0x20 klassOop[8]field Klass _size_helper 0x2c 4 intfield Klass _java_mirror 0x30 4 oopfield Klass _modifier_flags 0x34 4 jintfield Klass _super 0x38 4 klassOopfield Klass _name 0x3c 4 symbolOopfield Klass _access_flags 0x40 4 AccessFlagsfield Klass _subklass 0x44 4 klassOopfield Klass _next_sibling 0x48 4 klassOopfield Klass _alloc_count 0x4c 4 juintfield Klass _is_objArray 0x50 1 bool
  • 11. メソッドを表すクラスclass methodOopDesc oopDesc 0x58 falsefield methodOopDesc _constMethod 0 4 constMethodOopfield methodOopDesc _constants 4 4 constantPoolOopfield methodOopDesc _method_data 8 4 methodDataOopfield methodOopDesc _interpreter_invocation_count 0xc 4 intfield methodOopDesc _access_flags 0x10 4 AccessFlagsfield methodOopDesc _vtable_index 0x14 4 int:field methodOopDesc _method_size 0x18 2 u2field methodOopDesc _max_stack 0x1a 2 u2field methodOopDesc _max_locals 0x1c 2 u2field methodOopDesc _size_of_parameters 0x1e 2 u2:field methodOopDesc _i2i_entry 0x40 4 addressfield methodOopDesc _adapter 0x44 4 AdapterHandlerEntry*field methodOopDesc _from_compiled_entry 0x48 4 addressfield methodOopDesc _code 0x4c 4 nmethod*field methodOopDesc _from_interpreted_entry 0x50 4 address