pitrou commented on PR #41128:
URL: https://github.com/apache/arrow/pull/41128#issuecomment-2047943729

   We can see the difference in the code generated for freeing mimalloc memory:
   * before, there is a direct call to `mi_free`:
   ```
   00000000012e5900 
<_ZN5arrow18BaseMemoryPoolImplINS_12_GLOBAL__N_117MimallocAllocatorEE4FreeEPhll>:
    12e5900:    55                      push   %rbp
    12e5901:    48 3b 35 00 fb 47 00    cmp    0x47fb00(%rip),%rsi        # 
1765408 <_ZN5arrow11memory_pool8internal14zero_size_areaE@@Base-0x91b8>
    12e5908:    48 89 e5                mov    %rsp,%rbp
    12e590b:    41 54                   push   %r12
    12e590d:    49 89 d4                mov    %rdx,%r12
    12e5910:    53                      push   %rbx
    12e5911:    48 89 fb                mov    %rdi,%rbx
    12e5914:    74 09                   je     12e591f 
<_ZN5arrow18BaseMemoryPoolImplINS_12_GLOBAL__N_117MimallocAllocatorEE4FreeEPhll+0x1f>
    12e5916:    48 89 f7                mov    %rsi,%rdi
    12e5919:    67 e8 21 af 16 00       addr32 call 1450840 <mi_free>
    12e591f:    f0 4c 29 63 48          lock sub %r12,0x48(%rbx)
    12e5924:    5b                      pop    %rbx
    12e5925:    41 5c                   pop    %r12
    12e5927:    5d                      pop    %rbp
    12e5928:    c3                      ret    
   ```
   * after, there is an indirect call (the `call*`) through the jump table to 
`arrow_mi_free`:
   ```
   00000000012e5b00 
<_ZN5arrow18BaseMemoryPoolImplINS_12_GLOBAL__N_117MimallocAllocatorEE4FreeEPhll>:
    12e5b00:    55                      push   %rbp
    12e5b01:    48 3b 35 c0 f8 47 00    cmp    0x47f8c0(%rip),%rsi        # 
17653c8 <_ZN5arrow11memory_pool8internal14zero_size_areaE@@Base-0x91f8>
    12e5b08:    48 89 e5                mov    %rsp,%rbp
    12e5b0b:    41 54                   push   %r12
    12e5b0d:    49 89 d4                mov    %rdx,%r12
    12e5b10:    53                      push   %rbx
    12e5b11:    48 89 fb                mov    %rdi,%rbx
    12e5b14:    74 09                   je     12e5b1f 
<_ZN5arrow18BaseMemoryPoolImplINS_12_GLOBAL__N_117MimallocAllocatorEE4FreeEPhll+0x1f>
    12e5b16:    48 89 f7                mov    %rsi,%rdi
    12e5b19:    ff 15 51 6e 48 00       call   *0x486e51(%rip)        # 176c970 
<arrow_mi_free@@Base+0x47bad0>
    12e5b1f:    f0 4c 29 63 48          lock sub %r12,0x48(%rbx)
    12e5b24:    5b                      pop    %rbx
    12e5b25:    41 5c                   pop    %r12
    12e5b27:    5d                      pop    %rbp
    12e5b28:    c3                      ret    
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to