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)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15581
This commit is contained in:
Philippe Waroquiers 2015-08-21 22:22:27 +00:00
parent 893c2a3f08
commit 9e871fd7ba

View File

@ -54,14 +54,10 @@ UInt VG_N_THREADS;
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(