hmemory
hmemory is a memory error detector for c/c++ programs.
- overview
- configuration
- error reports
- test cases
- usage example
- contact
- license
1. overview
hmemory is a lightweight memory error detector for c/c++ programs, specifically designed for embedded systems.
main use case may include embedded systems where valgrind -
addrcheck, or
memcheck support is not available.
and has benefits of:
- has a negligible effect run-time speed
- does not require any source code change
- operating system and architecture independent
- easy to use
can detect errors of:
- double/invalid free
- mismatched use of malloc versus free
- writing before or end of malloc'd blocks
- invalid realloc
- overlapping src and dst pointers in memcpy
- memory leaks
2. configuration
- compile-time options
- run-time options
2.1. compile-time options
hthread configuration parameters can be set using make flags, please check example section for demonstration.
-
HTHREAD_ENABLE_CALLSTACK
default 1
enable/disable reporting call trace information on error, useful but depends on libbdf, libdl, and
backtrace function from glibc. may be disabled for toolchains which does not support backtracing.
-
HTHREAD_REPORT_CALLSTACK
default 1
dump callstack info (function call history) for error point.
-
HTHREAD_ASSERT_ON_ERROR
default 1
terminate the process on any pthreads api misuse and/or lock order violation.
2.2. run-time options
hthread reads configuration parameters from environment via getenv function call. one can either set/change environment
variables in source code of monitored project via setenv function call, or set them globally in running shell using
export function.
please check example section for demonstration.
3. error reports
4. test cases
5. usage example
6. contact
if you are using the software and/or have any questions, suggestions, etc. please contact with me at
alper.akcan@gmail.com
7. license
Copyright (C) 2008-2013 Alper Akcan alper.akcan@gmail.com
This work is free. It comes without any warranty, to the extent permitted
by applicable law. You can redistribute it and/or modify it under the terms
of the Do What The Fuck You Want To Public License, Version 2, as published
by Sam Hocevar. See the COPYING file for more details.
|