Fix/memory leaks

This pull request fixes a bunch of memory leaks in perm gen. Leaks were caused by ownb code and third party libraries.