[CSHARP-1150] Replace instances of new UTF8Encoding(false, true) with static singletons Created: 16/Dec/14  Updated: 16/Dec/14  Resolved: 16/Dec/14

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: 1.9.2
Fix Version/s: 1.10, 2.0

Type: Improvement Priority: Minor - P4
Reporter: Joe Enzminger Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible

 Description   

Doing some memory profiling revealed a significant number of allocations of UTF8Encoding instances. While these eventually get garbage collected they take up a significant amount of space in the interim. It looks like the BsonTrie<TValue> class has already done this. I would recommend doing it across the board.



 Comments   
Comment by Robert Stam [ 16/Dec/14 ]

We agree. In fact, the next release will incorporate this change.

See commit:

https://github.com/mongodb/mongo-csharp-driver/commit/3011795f71a54556813db310e2e769243ee908a7

Generated at Wed Feb 07 21:38:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.