Merge all other contributions

New features
Fix Windows bugs
I added it to be sure we regulary clean the memory.
I use this gem on logstash and we can have memory problem during mass write in logs.