How to trace "tcmalloc : large alloc .... "
Asked Answered
H

2

12

my app print several line like:

tcmalloc: large alloc 4294488064 bytes == 0x2b968d8000 @  0x727432 0x727302 0x727a58    0x75a07d 0x574beb 0x585756 0x5575df 0x5717db 0x57108f 0x58078c 0x302b80610a
tcmalloc: large alloc 4294488064 bytes == 0x2c97063000 @  0x727432 0x727302 0x727a58   0x75a07d 0x574beb 0x585756 0x5575df 0x5717db 0x57108f 0x58078c 0x302b80610a
tcmalloc: large alloc 4294488064 bytes == 0x2b968d8000 @  0x727432 0x727302 0x727a58 0x75a07d 0x574beb 0x585756 0x5575df 0x5717db 0x57108f 0x58078c 0x302b80610a

where does this message comes from? does it means my app has some bugs or memory-leak? how can I trace the root cause?

Hospitalet answered 31/1, 2012 at 9:54 Comment(3)
to trace the mem address to a line in your code, use addr2line commandline tool.. use it as addr2line -e <executable name> then press enter and then paste an address and press enter.Diuretic
Thanks. in this case, I paste the address at the end of lines, but get a "??:0"Hospitalet
you have to compile it using -g option.Diuretic
S
11

See http://code.google.com/p/gperftools/source/browse/trunk/src/tcmalloc.cc?r=80&redir=1 line 843

Depending on your application - the large allocation may or may not be a bug.

In any case - the part after the @ mark is a stack trace and can be used to locate the source of the message

The repeating number (4294488064 which seems to be equal to 4G-479232 or 0x100000000-0x75000) makes me suspect the original allocation call got a negative signed value and used it as an unsigned value.

Saccharase answered 31/1, 2012 at 9:59 Comment(1)
thanks, that is very helpful. the bug is just like you said, caused by mixing use of unsigned and signed valueHospitalet
R
1

If you still have the process running or were able to core dump it (kill -ABRT) then you should be able to attach gdb and run the info symbol <address> command (<address> is one of those hexadecimal numbers after @ in the error message: 0x727432 ...).

In my case it was an authentic error.

Revocation answered 18/3, 2014 at 19:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.