]> granicus.if.org Git - gc/commitdiff
Fix bytes count passed to add_to_our_memory in backgraph new_back_edges
authorIvan Maidanski <ivmai@mail.ru>
Wed, 2 Aug 2017 08:13:23 +0000 (11:13 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 8 Aug 2017 07:46:35 +0000 (10:46 +0300)
(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

index 4b087e43dca9175fab4d3808aeb584df8070b973..b40ccf34d807bbb15b64faa149d13cd9f0271026 100644 (file)
@@ -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;