object/MongOData — pull request #20 by netripper (2014-11-25 09:14:42+00:00)
Title: Fixed memory leak in DocumentTypeBuilder

This commit fixes a memory leak in the DocumentTypeBuilder. On each request to the dataservice, a new DynamicType{guid} type is created, which is then, later on, registered in the static Bson mapping classes of MongoDB. Once registered, they cannot be unregistered.

Before this patch, running with about 3 requests/sec for a few hours the w3wp process would take around 1.5-2GB of memory and keeps increasing. After this patch, the w3wp process is completely stable (in my case around 230MB).

Please note that this change seems to cause one test-case to fail (VariableTypesPrefetchNoneUpdate), but I don't see the reason why. It only runs through the changed code once before failing, which should yield the exact same result as without this patch.