realloc stack use under O0 for x86_64
    D'Alessandro, Luke K 
    ldalessa at indiana.edu
       
    Wed Mar 25 17:57:28 PDT 2015
    
    
  
> On Mar 25, 2015, at 8:34 PM, Jason Evans <jasone at canonware.com> wrote:
> 
> On Mar 25, 2015, at 11:48 AM, D'Alessandro, Luke K <ldalessa at indiana.edu> wrote:
>> We have a lightweight threading system where we are using very small stacks, on the order of 8-32k. We depend on jemalloc for scalable allocation.
>> 
>> 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
>> ```
> 
> Wow, that's far more stack space than I can imagine an explanation for.  What version of jemalloc is this happening with, which OS, compiler, etc.?
Hi Jason,
This was with
jemalloc: 562d266511053a51406e91c78eba640cb46ad9c8
./configure CFLAGS="-O0 -g”
uname -a
Linux #### 3.2.0-59-generic #90-Ubuntu SMP Tue Jan 7 22:43:51 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
* gcc 4.9.2
[original]
* gcc 4.6.4
0000000000070a26 <realloc>:
   70a26:       55                      push   %rbp
   70a27:       48 89 e5                mov    %rsp,%rbp
   70a2a:       53                      push   %rbx
   70a2b:       48 81 ec 18 5f 00 00    sub    $0x5f18,%rsp
* clang-3.6.0
000000000000aea0 <realloc>:
    aea0:       55                      push   %rbp
    aea1:       48 89 e5                mov    %rsp,%rbp
    aea4:       41 56                   push   %r14
    aea6:       53                      push   %rbx
    aea7:       48 81 ec c0 13 00 00    sub    $0x13c0,%rsp
Linux #### 3.0.101-0.31.1_1.0502.8394-cray_ari_s #1 SMP Wed Sep 10 04:03:41 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux:
* icc version 15.0.1 (gcc version 4.3.0 compatibility)
000000000007f2b7 <realloc>:
   7f2b7:       55                      push   %rbp
   7f2b8:       48 89 e5                mov    %rsp,%rbp
   7f2bb:       48 81 ec e0 79 00 00    sub    $0x79e0,%rsp
I’d be surprised if you didn’t see something like this with any gcc/LInux/CFLAGS=“-O0 -g” build.
Luke
    
    
More information about the jemalloc-discuss
mailing list