Author: Richard Plangger <planri...@gmail.com> Branch: vmprof-native Changeset: r90791:e72336569fc5 Date: 2017-03-22 15:29 -0300 http://bitbucket.org/pypy/pypy/changeset/e72336569fc5/
Log: dlclose must be called later, it worked for cpython because the process already holds a reference to libunwind and dlclose does not gargabe collect diff --git a/rpython/rlib/rvmprof/src/shared/vmp_stack.c b/rpython/rlib/rvmprof/src/shared/vmp_stack.c --- a/rpython/rlib/rvmprof/src/shared/vmp_stack.c +++ b/rpython/rlib/rvmprof/src/shared/vmp_stack.c @@ -451,6 +451,7 @@ #endif static const char * vmprof_error = NULL; +static void * libhandle = NULL; #ifdef VMPROF_LINUX @@ -469,10 +470,7 @@ #define UL_PREFIX "" #endif -extern void * __vmprof_eval_vmprof_addr; - int vmp_native_enable(void) { - void * libhandle; vmp_native_traces_enabled = 1; if (!unw_get_reg) { @@ -500,9 +498,6 @@ if (!(unw_getcontext = dlsym(libhandle, U_PREFIX PREFIX "_getcontext"))) { goto bail_out; } - if (dlclose(libhandle)) { - goto bail_out; - } } #if defined(__unix__) @@ -518,6 +513,14 @@ } void vmp_native_disable(void) { + + if (libhandle != NULL) { + if (dlclose(libhandle)) { + vmprof_error = dlerror(); + fprintf(stderr, "could close libunwind at runtime. error: %s\n", vmprof_error); + } + } + vmp_native_traces_enabled = 0; if (vmp_ranges != NULL) { free(vmp_ranges); _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit