realloc stack use under O0 for x86_64
D'Alessandro, Luke K
ldalessa at indiana.edu
Wed Mar 25 18:02:45 PDT 2015
> On Mar 25, 2015, at 8:47 PM, Matthew Hall <mhall at mhcomputing.net> wrote:
>
> On Mar 25, 2015, at 11:48 AM, D'Alessandro, Luke K <ldalessa at indiana.edu> wrote:
>> When we compile jemalloc for debugging purposes, we see realloc using a
>> large amount of stack space:
>>
>> ```asm
>> 0000000000070e48 <realloc>:
>> 70e48: 55 push %rbp
>> 70e49: 48 89 e5 mov %rsp,%rbp
>> 70e4c: 53 push %rbx
>> 70e4d: 48 81 ec 68 62 00 00 sub $0x6268,%rsp
>> ```
>
> I think perhaps we can do a little better on narrowing this down especially
> given you said that it occurs in -O0 mode.
>
> If you dump this code using objdump -C -d -l, it will try to find the file
> name and line number from the debug symbols, and annotate the assembly with
> these.
>
> Can you give it a try and search for the 0x6268 and scroll up from there to
> find the nearest lines of code to the issue?
Sure, hope this is what you’re after:
0000000000070e48 <realloc>:
realloc():
/u/ldalessa/jemalloc/src/jemalloc.c:1738
70e48: 55 push %rbp
70e49: 48 89 e5 mov %rsp,%rbp
70e4c: 53 push %rbx
70e4d: 48 81 ec 68 62 00 00 sub $0x6268,%rsp
70e54: 48 89 bd a8 9d ff ff mov %rdi,-0x6258(%rbp)
70e5b: 48 89 b5 a0 9d ff ff mov %rsi,-0x6260(%rbp)
/u/ldalessa/jemalloc/src/jemalloc.c:1740
70e62: 48 c7 85 60 9e ff ff movq $0x0,-0x61a0(%rbp)
70e69: 00 00 00 00
/u/ldalessa/jemalloc/src/jemalloc.c:1741
70e6d: 48 c7 85 58 9e ff ff movq $0x0,-0x61a8(%rbp)
70e74: 00 00 00 00
/u/ldalessa/jemalloc/src/jemalloc.c:1742
70e78: 48 c7 45 e0 00 00 00 movq $0x0,-0x20(%rbp)
70e7f: 00
/u/ldalessa/jemalloc/src/jemalloc.c:1743
70e80: 48 c7 45 d8 00 00 00 movq $0x0,-0x28(%rbp)
70e87: 00
/u/ldalessa/jemalloc/src/jemalloc.c:1745
70e88: 48 83 bd a0 9d ff ff cmpq $0x0,-0x6260(%rbp)
70e8f: 00
70e90: 0f 94 c0 sete %al
70e93: 0f b6 c0 movzbl %al,%eax
70e96: 48 85 c0 test %rax,%rax
70e99: 0f 84 74 04 00 00 je 71313 <realloc+0x4cb>
/u/ldalessa/jemalloc/src/jemalloc.c:1746
70e9f: 48 83 bd a8 9d ff ff cmpq $0x0,-0x6258(%rbp)
70ea6: 00
70ea7: 0f 84 5b 04 00 00 je 71308 <realloc+0x4c0>
je_tsd_get():
> Apologies if you already tried this and it didn't work. It helped me in the
> past.
No, I’m not an expert objdump user. Normally just -S things or read LLVM IR, but this file is so big that I didn’t want to do that if possible.
Luke
More information about the jemalloc-discuss
mailing list