summaryrefslogtreecommitdiff
path: root/thread_local_alloc.c
diff options
context:
space:
mode:
authorhboehm <hboehm>2007-05-11 23:55:38 +0200
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 19:06:39 +0200
commit074de161d5ee7aa09d143cd30c36ead67a4a2085 (patch)
treef093509be4f2a33b37344e1208587711cfe7e0ba /thread_local_alloc.c
parent9bafc5a014fb9f8042c16af23ca807a277b7c87d (diff)
2007-05-11 Hans Boehm <Hans.Boehm@hp.com>
* dbg_mlc.c, include/gc.h, finalize.c: Merge Alexandre Oliva's GC_debug_register_finalizer_unreachable() patch from gcc tree. * thread_local_alloc.c (GC_malloc, GC_malloc_atomic): Add assertions to check GC has been initialized.
Diffstat (limited to 'thread_local_alloc.c')
-rw-r--r--thread_local_alloc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/thread_local_alloc.c b/thread_local_alloc.c
index cfdb6d7..6c2bff3 100644
--- a/thread_local_alloc.c
+++ b/thread_local_alloc.c
@@ -150,6 +150,7 @@ void * GC_malloc(size_t bytes)
}
tsd = GC_getspecific(k);
# else
+ GC_ASSERT(GC_is_initialized);
tsd = GC_getspecific(GC_thread_key);
# endif
# if defined(REDIRECT_MALLOC) && defined(USE_PTHREAD_SPECIFIC)
@@ -181,7 +182,10 @@ void * GC_malloc_atomic(size_t bytes)
{
size_t granules = ROUNDED_UP_GRANULES(bytes);
void *result;
- void **tiny_fl = ((GC_tlfs)GC_getspecific(GC_thread_key))
+ void **tiny_fl;
+
+ GC_ASSERT(GC_is_initialized);
+ tiny_fl = ((GC_tlfs)GC_getspecific(GC_thread_key))
-> ptrfree_freelists;
GC_FAST_MALLOC_GRANS(result, bytes, tiny_fl, DIRECT_GRANULES,
PTRFREE, GC_core_malloc_atomic(bytes), 0/* no init */);