Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8284620

CodeBuffer may leak _overflow_arena

    XMLWordPrintable

Details

    • b18

    Backports

      Description

        CodeBuffer is declared as StackObj, but it also has ResourceObj style new operator, to complicate thing further more, it has _overflow_arena that is C Heap allocated.

        When Stack allocated CodeBuffer owns _overflow_arena, it works fine, because its destructor frees _overflow_arena. But if resource allocated CodeBuffer owns _overflow_arena, the arena is leaked, because its destructor is never called.

        ==1139627== 2,096 (96 direct, 2,000 indirect) bytes in 2 blocks are definitely lost in loss record 12,196 of 12,553
        ==1139627== at 0x484486F: malloc (vg_replace_malloc.c:381)
        ==1139627== by 0x5AE5B9E: malloc (os.cpp:656)
        ==1139627== by 0x5AE5B9E: os::malloc(unsigned long, MEMFLAGS, NativeCallStack const&) (os.cpp:632)
        ==1139627== by 0x527F216: AllocateHeap(unsigned long, MEMFLAGS, NativeCallStack const&, AllocFailStrategy::AllocFailEnum) (allocation.cpp:42)
        ==1139627== by 0x52887B8: Arena::operator new(unsigned long, MEMFLAGS) (arena.cpp:286)
        ==1139627== by 0x545E16E: CodeBuffer::create_patch_overflow() (codeBuffer.cpp:245)
        ==1139627== by 0x529A1BA: Label::add_patch_at(CodeBuffer*, int, char const*, int) (assembler.cpp:166)
        ==1139627== by 0x529ED05: Assembler::jcc(Assembler::Condition, Label&, bool) (assembler_x86.cpp:2320)
        ==1139627== by 0x5188724: jmpConUNode::emit(CodeBuffer&, PhaseRegAlloc*) const (x86_64.ad:12758)
        ==1139627== by 0x5B0759F: PhaseOutput::fill_buffer(CodeBuffer*, unsigned int*) (output.cpp:1681)
        ==1139627== by 0x548A7C1: Compile::Code_Gen() (compile.cpp:2858)
        ==1139627== by 0x548E7BC: Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*) (compile.cpp:849)
        ==1139627== by 0x53CD12F: C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*) (c2compiler.cpp:112)
        ==1139627== by 0x5496A03: CompileBroker::invoke_compiler_on_method(CompileTask*) (compileBroker.cpp:2294)
        ==1139627== by 0x54975FF: CompileBroker::compiler_thread_loop() (compileBroker.cpp:1967)
        ==1139627== by 0x5D496BD: JavaThread::thread_main_inner() (thread.cpp:1291)
        ==1139627== by 0x5D4F3AF: Thread::call_run() (thread.cpp:356)
        ==1139627== by 0x5AF0EA7: thread_native_entry(Thread*) (os_linux.cpp:706)
        ==1139627== by 0x4927B19: start_thread (pthread_create.c:443)
        ==1139627== by 0x49AB8E3: clone (clone.S:100)

         

        Attachments

          Issue Links

            Activity

              People

                zgu Zhengyu Gu
                zgu Zhengyu Gu
                Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: