diff --git a/source/memtrace.c b/source/memtrace.c index c9f33ed01..9c5bff60c 100644 --- a/source/memtrace.c +++ b/source/memtrace.c @@ -440,14 +440,14 @@ static void *s_trace_mem_realloc(struct aws_allocator *allocator, void *old_ptr, void *new_ptr = old_ptr; /* - * Careful with the ordering of state clean up here. - * Tracer keeps a hash table (alloc ptr as key) of meta info about each allocation. - * To avoid race conditions during realloc state update needs to be done in - * following order to avoid race conditions: - * - remove meta info (other threads cant reuse that key, cause ptr is still valid ) - * - realloc (cant fail, ptr might remain the same) - * - add meta info for reallocated mem - */ + * Careful with the ordering of state clean up here. + * Tracer keeps a hash table (alloc ptr as key) of meta info about each allocation. + * To avoid race conditions during realloc state update needs to be done in + * following order to avoid race conditions: + * - remove meta info (other threads cant reuse that key, cause ptr is still valid ) + * - realloc (cant fail, ptr might remain the same) + * - add meta info for reallocated mem + */ s_alloc_tracer_untrack(tracer, old_ptr); aws_mem_realloc(tracer->traced_allocator, &new_ptr, old_size, new_size); s_alloc_tracer_track(tracer, new_ptr, new_size); diff --git a/tests/alloc_test.c b/tests/alloc_test.c index e5337d1db..21f6d8c3c 100644 --- a/tests/alloc_test.c +++ b/tests/alloc_test.c @@ -148,7 +148,10 @@ static void s_threaded_alloc_worker(void *user_data) { } } -static void s_thread_test(struct aws_allocator *allocator, void (*thread_fn)(void *), struct aws_allocator *test_allocator) { +static void s_thread_test( + struct aws_allocator *allocator, + void (*thread_fn)(void *), + struct aws_allocator *test_allocator) { const struct aws_thread_options *thread_options = aws_default_thread_options(); struct aws_thread threads[NUM_TEST_THREADS]; struct allocator_thread_test_data thread_data[NUM_TEST_THREADS];