Wednesday, June 3, 2009

New Deadwood snapshot

I'm done some testing with DwHash to make sure we can do a lot of hash operations and generate no errors that Valgrind can see (all allocated memory is freed, no errors that Valgrind reports).

Now, I will make sure I can have a version of Deadwood that doesn't generate any Valgrind errors when compiled with -DVALGRIND_NOERRORS (Valgrind doesn't like how Deadwood reads uninitialized memory to get more entropy for the random number generator).

Then, I will convert DwDict to use DwHash routines instead of its current simple hash. After that, I will release Deadwood 2.4.03.

Note that DwDict's hash wastes a little memory. In more detail, the hash as a whole has a single unused pointer (fila) and an unused 32-bit value (max); this wastes 8 bytes on a 32-bit system and 12 (or 16 depending on how the structure is padded [1]) on a 64-bit system. Each element has a single unused pointer (fila) and unused 64-bit value (expire). This wastes 12 bytes per element on a 32-bit system and 16 bytes per element on a 64-bit system (or more depending on how the structure is padded).

I'm doing things this way so I only have one codebase to maintain (the DwHash codebase) and because changing things to not have this waste is more bother than it's worth in C. Can you say not an object oriented language?

The snapshot can be seen at maradns.org/deadwood/snap

[1] Is there a "don't pad structures" GCC option? There really should be.