summaryrefslogtreecommitdiff
path: root/lib/talloc/talloc_guide.txt
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-09-24 19:20:06 +0200
committerVolker Lendecke <vl@samba.org>2010-09-24 17:21:42 -0700
commite325a5b67453fd8cfe06d3d0d6c7c5ab7e4ad772 (patch)
tree0129f5e7d0e451fbc33720a373887a38afffa72f /lib/talloc/talloc_guide.txt
parente90c707f144a362a708f5d2f3eb85192dc98980a (diff)
downloadsamba-e325a5b67453fd8cfe06d3d0d6c7c5ab7e4ad772.tar.gz
samba-e325a5b67453fd8cfe06d3d0d6c7c5ab7e4ad772.tar.bz2
samba-e325a5b67453fd8cfe06d3d0d6c7c5ab7e4ad772.zip
talloc: Add a warning about talloc_autofree_context() and dlclose()
Diffstat (limited to 'lib/talloc/talloc_guide.txt')
-rw-r--r--lib/talloc/talloc_guide.txt13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/talloc/talloc_guide.txt b/lib/talloc/talloc_guide.txt
index a79fd03a83..f29b1d699a 100644
--- a/lib/talloc/talloc_guide.txt
+++ b/lib/talloc/talloc_guide.txt
@@ -74,6 +74,19 @@ without proper synchronization ;
shouldn't be used by several threads simultaneously without
synchronization.
+talloc and shared objects
+-------------------------
+
+talloc can be used in shared objects. Special care needs to be taken
+to never use talloc_autofree_context() in code that might be loaded
+with dlopen() and unloaded with dlclose(), as talloc_autofree_context()
+internally uses atexit(3). Some platforms like modern Linux handles
+this fine, but for example FreeBSD does not deal well with dlopen()
+and atexit() used simultaneously: dlclose() does not clean up the list
+of atexit-handlers, so when the program exits the code that was
+registered from within talloc_autofree_context() is gone, the program
+crashes at exit.
+
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
(type *)talloc(const void *context, type);