summaryrefslogtreecommitdiff
path: root/docs/memory_management.md
blob: 5363f7aff2582b4c13762d15e0e5fe76d7f08caa (plain)
1
2
3
4
5
6
# Memory Management

-   Avoid using bare pointers for dynamically allocated objects. Prefer `std::unique_ptr`,
    `std::shared_ptr`, or another RAII class such as `BSONObj`.
-   If you assign the output of `new/malloc()` directly to a bare pointer you should document where
    it gets deleted/freed, who owns it along the way, and how exception safety is ensured.