summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Evans <je@fb.com>2011-08-09 00:10:07 (GMT)
committerJason Evans <je@fb.com>2011-08-09 00:10:07 (GMT)
commit41b954ed36f90e5a479bbe2118b5ce85189a55ee (patch)
tree34ab5fb39bdb215ca1bb935ef0c523e7c0cec30b
parent04ca1efe35349a6114523b37abbd4ca066cd17fa (diff)
downloadjemalloc-41b954ed36f90e5a479bbe2118b5ce85189a55ee.zip
jemalloc-41b954ed36f90e5a479bbe2118b5ce85189a55ee.tar.gz
jemalloc-41b954ed36f90e5a479bbe2118b5ce85189a55ee.tar.bz2
Use prof_tdata_cleanup() argument.
Use the argument to prof_tdata_cleanup(), rather than calling PROF_TCACHE_GET(). This fixes a bug in the NO_TLS case.
-rw-r--r--src/prof.c43
1 files changed, 19 insertions, 24 deletions
diff --git a/src/prof.c b/src/prof.c
index 6549375..a268e58 100644
--- a/src/prof.c
+++ b/src/prof.c
@@ -1109,7 +1109,6 @@ prof_tdata_init(void)
prof_tdata->vec = imalloc(sizeof(void *) * prof_bt_max);
if (prof_tdata->vec == NULL) {
-
ckh_delete(&prof_tdata->bt2cnt);
idalloc(prof_tdata);
return (NULL);
@@ -1127,33 +1126,29 @@ prof_tdata_init(void)
static void
prof_tdata_cleanup(void *arg)
{
- prof_tdata_t *prof_tdata;
+ prof_thr_cnt_t *cnt;
+ prof_tdata_t *prof_tdata = (prof_tdata_t *)arg;
- prof_tdata = PROF_TCACHE_GET();
- if (prof_tdata != NULL) {
- prof_thr_cnt_t *cnt;
-
- /*
- * Delete the hash table. All of its contents can still be
- * iterated over via the LRU.
- */
- ckh_delete(&prof_tdata->bt2cnt);
+ /*
+ * Delete the hash table. All of its contents can still be
+ * iterated over via the LRU.
+ */
+ ckh_delete(&prof_tdata->bt2cnt);
- /*
- * Iteratively merge cnt's into the global stats and delete
- * them.
- */
- while ((cnt = ql_last(&prof_tdata->lru_ql, lru_link)) != NULL) {
- prof_ctx_merge(cnt->ctx, cnt);
- ql_remove(&prof_tdata->lru_ql, cnt, lru_link);
- idalloc(cnt);
- }
+ /*
+ * Iteratively merge cnt's into the global stats and delete
+ * them.
+ */
+ while ((cnt = ql_last(&prof_tdata->lru_ql, lru_link)) != NULL) {
+ prof_ctx_merge(cnt->ctx, cnt);
+ ql_remove(&prof_tdata->lru_ql, cnt, lru_link);
+ idalloc(cnt);
+ }
- idalloc(prof_tdata->vec);
+ idalloc(prof_tdata->vec);
- idalloc(prof_tdata);
- PROF_TCACHE_SET(NULL);
- }
+ idalloc(prof_tdata);
+ PROF_TCACHE_SET(NULL);
}
void