commit dba45dcff656af2296096ae60ed01f416ecd64b3
parent 2e3673c176dac608d8c69787e34a27cb1046a638
Author: Remy Noulin <loader2x@gmail.com>
Date: Fri, 2 Aug 2019 13:51:21 +0200
Revert "fix bug due to variable name collisions in range, use rangeM instead"
This reverts commit 2e3673c176dac608d8c69787e34a27cb1046a638.
This is not true, there are no variable name collisions.
The problems happens because of bit flips in the RAM (Hardware problem).
The machine is:
Intel NUC
Intel(R) Core(TM) i7-7567U CPU @ 3.50GHz (Kaby Lake) (2017 14mn)
2 DDR4 Crucial Dimms 16GB (total 32GB RAM)
When running a hashtable test using 1.7GB RAM, bit flips happen
randomly in RAM and the program crashes when the bit flips happen
in memory cells storing pointers.
The bit flips start happening after running the test serveral times
for at least 30 seconds (in average running the test 5 times).
Running the binary on a desktop having the same OS 25 times gives
no error.
To reduce the occurences of bit flips, one can:
- increase the refresh rate of DDR4 in the bios
- buy an Intel XEON CPU and RAM supporting ECC and pTRR
(pseudo Target Row Refresh)
From
https://www.intel.com/content/www/us/en/products/devices-systems/laptops/mobile-workstations.html?processors=1016
in the Error Correcting Code (ECC) Memory section:
The longer a system operates throughout the day, the greater risk it has
for memory errors and this risk increases with the age of the system.
Diffstat:
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/hashtable.h b/hashtable.h
@@ -526,8 +526,8 @@ u32 ilog2Hashtable(u32 value);
typeof((name).node) *(*UNIQVAR(list))[][2] = malloc(UNIQVAR(new_size) * 2 * sizeof(typeof((name).node)*));\
if (!UNIQVAR(list)) {(name).res = false; break;}\
memset(UNIQVAR(list), 0, UNIQVAR(new_size) * 2 * sizeof(typeof((name).node)*));\
- rangeM(UNIQVAR(i), (name).size) {\
- rangeM(UNIQVAR(moreLessIdx), 2) {\
+ range(UNIQVAR(i), (name).size) {\
+ range(UNIQVAR(moreLessIdx), 2) {\
for (typeof((name).node) *UNIQVAR(node) = (*(name).list)[UNIQVAR(i)][UNIQVAR(moreLessIdx)]; UNIQVAR(node);) {\
typeof((name).node) *UNIQVAR(next) = UNIQVAR(node)->next;\
u32 UNIQVAR(mhash) = UNIQVAR(node)->hash & (name).szMask;\
diff --git a/package.yml b/package.yml
@@ -1,6 +1,6 @@
---
name: hashtable
- version: 0.0.15
+ version: 0.0.14
description: "hash table macros for creating hash table functions, it supports any type key, value, hash"
bin: ./hashtable.c
cflags: "-O1 -std=gnu11 -fPIC -pipe"