chad3814 / node-hashtable

Native hashtable interface for when V8 objects can't take the heat
MIT License
106 stars 41 forks source link

Hashtable is broken after repeated puts on same key #15

Closed jhuckaby closed 9 years ago

jhuckaby commented 9 years ago

Looks like memory gets corrupted and keys and values get switched. Check out this example snippet of code:

var Hashtable = require('hashtable');
var ht = new Hashtable();
ht.put('key_1', 'value_1');
ht.put('key_1', 'value_1'); // repeating same put
ht.put('key_2', 'value_2');

var value = ht.get('key_1');
console.log(value); // should be "value_1", but is not.

This should output "value_1", but instead it outputs "key_2", which makes no sense. It seems that if you repeat a put on the same key, it corrupts memory.

Node v0.10.33, OS X 10.10.1, Hashtable v0.5.2.

chad3814 commented 9 years ago

I'm sorry, I never got emails about issues or pull requests from this repo.

this is fixed in 0.5.3, sorry it took so long.