Use custom memory management implemented by mongodb

Since mongodb implemented same functionality I added before(according to my pull request https://github.com/mongodb/libbson/pull/70) we should use it, so I reverted my implementation and merged master branch from mongodb.