fixed broken NIF memory and thread handling
add some specs
Merge pull request #2 from istr/master

Crashes on eunit test and on VM exit: the NIF thread / memory stuff is severely broken.