|
From: <sv...@va...> - 2015-08-21 22:22:35
|
Author: philippe
Date: Fri Aug 21 23:22:27 2015
New Revision: 15581
Log:
Use VG_(arena_memalign) for thread array rather than VG_(malloc)-ed + align
Objective is to avoid a 'possibly lost' leak when self-hosting
(and re-uses the already existing align logic in m_mallocfree.c)
Modified:
trunk/coregrind/m_threadstate.c
Modified: trunk/coregrind/m_threadstate.c
==============================================================================
--- trunk/coregrind/m_threadstate.c (original)
+++ trunk/coregrind/m_threadstate.c Fri Aug 21 23:22:27 2015
@@ -54,14 +54,10 @@
void VG_(init_Threads)(void)
{
ThreadId tid;
- UChar *addr, *aligned_addr;
- addr = VG_(malloc)("init_Threads",
- VG_N_THREADS * sizeof VG_(threads)[0] + LibVEX_GUEST_STATE_ALIGN - 1);
-
- // Align
- aligned_addr = addr + (Addr)addr % LibVEX_GUEST_STATE_ALIGN;
- VG_(threads) = (ThreadState *)aligned_addr;
+ VG_(threads) = VG_(arena_memalign) (VG_AR_CORE, "init_Threads",
+ LibVEX_GUEST_STATE_ALIGN,
+ VG_N_THREADS * sizeof VG_(threads)[0]);
for (tid = 1; tid < VG_N_THREADS; tid++) {
INNER_REQUEST(
|