|
From: John R. <jr...@bi...> - 2009-11-29 19:07:15
|
> ... any way to report all the locations
> where memory is allocated. ...
A static list of all the locations that _can_ allocate memory
is useful, especially for an embedded environment ("If any location
_can_ allocate memory, then eventually it _will_, often when memory
is least available.")
A pipeline such as this will identify all the compilation units
with calls to alloc or new:
nm -gop $(find . -name '*.[oa]') | grep -E 'alloc|new'
A pipeline such as this will identify the locations of calls
to alloc or new:
readelf --relocs $(find . -name '*.o') | grep -E 'alloc|new'
You may wish to insert " | c++filt " into the pipeline
to demangle subroutine names. Also 'addr2line' can help
identify line numbers.
--
|