[llvm-bugs] [Bug 48237] New: Memory leak, when executing expressions

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Nov 20 01:27:15 PST 2020


https://bugs.llvm.org/show_bug.cgi?id=48237

            Bug ID: 48237
           Summary: Memory leak, when executing expressions
           Product: lldb
           Version: 11.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at lists.llvm.org
          Reporter: mplaneta at os.inf.tu-dresden.de
                CC: jdevlieghere at apple.com, llvm-bugs at lists.llvm.org

Hello,

When I attach to a process and executes some expressions, lldb allocates memory
to JIT-compile the code inside the process address space. Unfortunately, lldb
does not clean up this memory upon exit.

## How to reproduce

I create a multithreaded program 'victim-malloc' that makes free(malloc()) in a
busy loop. First, I let the program run, then I record the memory map of the
program:

    $ cat  /proc/$(pidof victim-malloc)/maps > /tmp/a

I attach to the program using lldb and run an expression

    $ lldb-11 -p $(pidof victim-malloc)
    (lldb) expression -- (int) printf("Hello");

I exit from lldb, record the memory map second time and look at the diff.

    $ cat  /proc/$(pidof victim-malloc)/maps > /tmp/b
    $ diff -p /tmp/a /tmp/b

Here is the result:

*** /tmp/a      2020-11-20 10:21:25.434149021 +0100
--- /tmp/b      2020-11-20 10:22:35.098652870 +0100
***************
*** 57,65 ****
--- 57,69 ----
  7f7bc770c000-7f7bc770d000 r--p 0001b000 fd:01 541618                    
/lib/x86_64-linux-gnu/libpthread-2.31.so
  7f7bc770d000-7f7bc770e000 rw-p 0001c000 fd:01 541618                    
/lib/x86_64-linux-gnu/libpthread-2.31.so
  7f7bc770e000-7f7bc7714000 rw-p 00000000 00:00 0 
+ 7f7bc7747000-7f7bc7748000 r-xp 00000000 00:00 0 
+ 7f7bc7748000-7f7bc7749000 rw-p 00000000 00:00 0 
+ 7f7bc7749000-7f7bc774a000 r--p 00000000 00:00 0 
  7f7bc774a000-7f7bc774b000 r--p 00000000 fd:01 528343                    
/lib/x86_64-linux-gnu/ld-2.31.so
  7f7bc774b000-7f7bc776b000 r-xp 00001000 fd:01 528343                    
/lib/x86_64-linux-gnu/ld-2.31.so
  7f7bc776b000-7f7bc7773000 r--p 00021000 fd:01 528343                    
/lib/x86_64-linux-gnu/ld-2.31.so
+ 7f7bc7773000-7f7bc7774000 rwxp 00000000 00:00 0 
  7f7bc7774000-7f7bc7775000 r--p 00029000 fd:01 528343                    
/lib/x86_64-linux-gnu/ld-2.31.so
  7f7bc7775000-7f7bc7776000 rw-p 0002a000 fd:01 528343                    
/lib/x86_64-linux-gnu/ld-2.31.so
  7f7bc7776000-7f7bc7777000 rw-p 00000000 00:00 0 


New regions were created by lldb and not cleaned up after exit.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20201120/3a2ebed2/attachment.html>


More information about the llvm-bugs mailing list