Menu

Tree [fbe56f] master /
 History

HTTPS access


File Date Author Commit
 .github 2024-11-23 Hannes Domani Hannes Domani [a4322f] sign release build with SignPath
 css 2021-06-29 Armin Stebich Armin Stebich [961278] added leaks.css example
 testres 2024-05-09 Hannes Domani Hannes Domani [5eef59] fix exceptions caught by SEH signal handler
 .gitignore 2018-01-15 Orgad Shaneh Orgad Shaneh [36b2a7] GitIgnore user files
 .gitmodules 2018-01-14 Orgad Shaneh Orgad Shaneh [4afca2] Add dwarfstack as a submodule
 LICENSE_1_0.txt 2014-04-16 Hannes Domani Hannes Domani [b4b8af] Initial commit
 Makefile 2025-05-31 Hannes Domani Hannes Domani [8df61b] update copyright years
 README.md 2025-05-29 Hannes Domani Hannes Domani [3578b5] add examples to README
 allocer.cpp 2025-05-31 Hannes Domani Hannes Domani [8df61b] update copyright years
 build.bat 2021-02-02 Marek Krajewski EXT Marek Krajewski EXT [558094] only pause build.bat if double-clicked
 crt32-vc6.def 2014-07-02 Hannes Domani Hannes Domani [1e1b11] compare allocation/release method
 crt32.def 2016-07-08 Hannes Domani Hannes Domani [106cd0] fix operator delete[](size_t)
 crt64.def 2016-07-08 Hannes Domani Hannes Domani [106cd0] fix operator delete[](size_t)
 dll-alloc.cpp 2025-05-31 Hannes Domani Hannes Domani [8df61b] update copyright years
 heob-inj.c 2025-07-15 Hannes Domani Hannes Domani [7baa30] improved wow64 process detection
 heob-internal.h 2025-07-15 Hannes Domani Hannes Domani [7baa30] improved wow64 process detection
 heob-ver.rc 2018-09-01 Hannes Domani Hannes Domani [c4b72b] option for svg output
 heob.c 2025-07-18 Hannes Domani Hannes Domani [fbe56f] fix conversion warning
 heob.h 2025-05-31 Hannes Domani Hannes Domani [8df61b] update copyright years
 heob.ico 2017-10-04 Hannes Domani Hannes Domani [8b3432] add icon
 heob.manifest 2016-10-18 Hannes Domani Hannes Domani [2d7996] add version info and manifest
 heob.qbs 2024-11-23 Hannes Domani Hannes Domani [e8fd83] set version 4.2-dev
 logo-16.png 2018-03-01 Hannes Domani Hannes Domani [6ca470] add artifact download to README
 svg.js 2025-05-31 Hannes Domani Hannes Domani [8df61b] update copyright years
 vc.bat 2016-04-14 Hannes Domani Hannes Domani [89a6b8] VC: build with optimization

Read Me

heob - heap observer

build status
latest build

heob overrides the heap functions of the called process to detect
buffer overruns and memory leaks.

On buffer overruns an access violation is raised, and stacktraces
of the offending instruction and buffer allocation are provided.

When the program exits normally, stacktraces for all leaks are shown.

compilation:

MinGW

The location of dwarfstack.h has to be provided.

make CPPFLAGS="-I../dwarfstack/include"

Or disable dwarfstack completely (this is the default).

make CPPFLAGS="-DNO_DWARFSTACK"

MSVC

Run build.bat in the source directory.

notes:

To get file/line information in stacktraces of executables with
DWARF debug information (gcc), dwarfstack.dll needs to be available.
For PDB debug information, dbghelp.dll is used.

examples:

memory leaks

Show all unfreed memory at target exit as flame graph in leaks.svg.

heob64 -vleaks.svg -p0 TARGET-EXE-PLUS-ARGUMENTS

With -k1 or -k2 it's possible to interactively enable/disable leak
recording, or write all currently recorded unfreed memory at any time before
target exit.

heob64 -vleaks.svg -p0 -k1 TARGET-EXE-PLUS-ARGUMENTS

heap check

Usually when looking for heap overflow or similar errors, the memory leak
output is not desired, so disable it with -l0.

Check for heap buffer overflow.

heob64 -p1 -l0 TARGET-EXE-PLUS-ARGUMENTS

Check for heap buffer underflow.

heob64 -p2 -l0 TARGET-EXE-PLUS-ARGUMENTS

Check for use-after-free of heap buffers (needs also -p1 or -p2 enabled
to work).

heob64 -p1 -f1 -l0 TARGET-EXE-PLUS-ARGUMENTS

These heap check options work by reserving extra unaccessible pages
after/before all buffer allocations to detect overflow/underflow, which
needs a lot of address space, so works (for any non-trivial program) only
with 64bit executables.

To get the heob output in a file instead of the console, use -o, and if
the output file name ends in .html, it will also be colored.
In that case I also suggest enabling full exception details with -D15 and
full paths with -F1.

heob64 -p1 -f1 -l0 -ocrash.html -D15 -F1 TARGET-EXE-PLUS-ARGUMENTS

profiling

Show sampling profiler result as flame graph in prof.svg.

heob64 -vprof.svg -I10 TARGET-EXE-PLUS-ARGUMENTS

Similar to memory leaks, this can also be interactively controlled with
-k1 or -k2.

heob64 -vprof.svg -I10 -k1 TARGET-EXE-PLUS-ARGUMENTS

sub-processes

It's possible to automatically inject heob in all subprocesses if either
%p or %c is part of the -o file name.
Option -h2 disables all memory leak and heap check functionality, so this
just gives an output file for each process and sub-process started by
the target executable.

heob64 -oprocs-%c-%n-%p-%N-%P.html -h2 TARGET-EXE-PLUS-ARGUMENTS

dll dependencies

If a target program can't be started because of some dll dependencies
problem (like missing exported functions), heob will give the exact reason.
But it's also possible to check for this explicitely, without running any
target code, and which works for dll's as well.

heob64 -Y1 SOME-EXE-OR-DLL

Or list all exported and imported symbols.

heob64 -Y2 SOME-EXE-OR-DLL

minidumps

Show exception information (including stacktrace) of minidump.

heob64 -D15 -F1 SOME-MINIDUMP

Create minidump of a running process.

heob64 -#PID

code signing:

Free code signing provided by SignPath.io, certificate by SignPath Foundation

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.