String literals causing small memory leak?

前端 未结 4 1653
轮回少年
轮回少年 2020-12-22 04:10

I have a C function that is called thousands of times and I have noticed that it is the only possible place for a memory leak. I have used Valgrind and Totalview\'s

4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-22 04:55

    No. A string literal has static storage duration and so its storage is reserved prior to the program startup and its lifetime is the entire execution of the program.

提交回复
热议问题