From 52d0727c266bda1ac5800010003f8607c89cffb5 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Wed, 2 Aug 2017 11:13:23 +0300 Subject: [PATCH] Fix bytes count passed to add_to_our_memory in backgraph new_back_edges (fix commit 180b56c) * backgraph.c [MAKE_BACK_GRAPH] (new_back_edges): Pass bytes_to_get to GC_add_to_our_memory() (i.e. pass the same number of bytes as passed to GET_MEM() even in case of MMAP_SUPPORTED). --- backgraph.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/backgraph.c b/backgraph.c index 743f2660..675df1f5 100644 --- a/backgraph.c +++ b/backgraph.c @@ -86,13 +86,13 @@ static back_edges *avail_back_edges = 0; static back_edges * new_back_edges(void) { if (0 == back_edge_space) { - back_edge_space = (back_edges *)GET_MEM( - ROUNDUP_PAGESIZE_IF_MMAP(MAX_BACK_EDGE_STRUCTS - * sizeof(back_edges))); + size_t bytes_to_get = ROUNDUP_PAGESIZE_IF_MMAP(MAX_BACK_EDGE_STRUCTS + * sizeof(back_edges)); + + back_edge_space = (back_edges *)GET_MEM(bytes_to_get); if (NULL == back_edge_space) ABORT("Insufficient memory for back edges"); - GC_add_to_our_memory((ptr_t)back_edge_space, - MAX_BACK_EDGE_STRUCTS*sizeof(back_edges)); + GC_add_to_our_memory((ptr_t)back_edge_space, bytes_to_get); } if (0 != avail_back_edges) { back_edges * result = avail_back_edges; -- 2.40.0