memory leak unit test c++

后端 未结 6 1199
天涯浪人
天涯浪人 2021-01-05 18:15

I have just resolved a memory leak in my application and now I want to write a unit test to ensure that this does not happen again.

I\'m look for a way to detect th

6条回答
  •  清酒与你
    2021-01-05 18:52

    For Linux or other systems that use GLibC there are functions to get memory allocation statistics. Assuming no lazy allocations, you should have the same memory committed to malloc before and after you perform your test.

提交回复
热议问题