diff options
author | Ian Lance Taylor <iant@golang.org> | 2018-10-05 14:09:07 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-10-05 14:09:07 +0000 |
commit | a2a86641b76dfd5606606d5a49fa64c20f0d9245 (patch) | |
tree | 47a1d357500d2aec20c7e1e206f756c001db2cc8 /libbacktrace/backtrace.h | |
parent | f48bd5e43acaa30252437f2d6faae1d18de08388 (diff) | |
download | gcc-a2a86641b76dfd5606606d5a49fa64c20f0d9245.tar.gz |
re PR libbacktrace/87529 (libbacktrace API forces users to have memory leaks)
PR libbacktrace/87529
* backtrace.h: Document that backtrace_create_state should be
called only once.
From-SVN: r264871
Diffstat (limited to 'libbacktrace/backtrace.h')
-rw-r--r-- | libbacktrace/backtrace.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libbacktrace/backtrace.h b/libbacktrace/backtrace.h index f07fa6c585e..83439ffadce 100644 --- a/libbacktrace/backtrace.h +++ b/libbacktrace/backtrace.h @@ -92,7 +92,13 @@ typedef void (*backtrace_error_callback) (void *data, const char *msg, use appropriate atomic operations. If THREADED is zero the state may only be accessed by one thread at a time. This returns a state pointer on success, NULL on error. If an error occurs, this will - call the ERROR_CALLBACK routine. */ + call the ERROR_CALLBACK routine. + + Calling this function allocates resources that can not be freed. + There is no backtrace_free_state function. The state is used to + cache information that is expensive to recompute. Programs are + expected to call this function at most once and to save the return + value for all later calls to backtrace functions. */ extern struct backtrace_state *backtrace_create_state ( const char *filename, int threaded, |