Explorar o código

Work around hwloc's failure to return the amount of RAM.

Ludovic Courtès %!s(int64=13) %!d(string=hai) anos
pai
achega
508463598a
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      tests/datawizard/reclaim.c

+ 4 - 1
tests/datawizard/reclaim.c

@@ -73,7 +73,10 @@ int main(int argc, char **argv)
 	/* We allocate 50% of the memory */
 	uint64_t total_size = get_total_memory_size();
 
-	mb = (int)((0.50 * total_size)/(BLOCK_SIZE));
+	/* On x86_64-freebsd8.2, hwloc 1.3 returns 0 as the total memory
+	 * size, so sanity-check what we have.  */
+	if (total_size > 0)
+		mb = (int)((0.50 * total_size)/(BLOCK_SIZE));
 #endif
 
 	/* An optional argument indicates the number of MB to allocate */