Do Small Memory Leaks Matter Anymore?

后端 未结 17 979
春和景丽
春和景丽 2021-02-01 04:03

With RAM typically in the Gigabytes on all PC\'s now, should I be spending time hunting down all the small (non-growing) memory leaks that may be in my program? I\'m talking abo

17条回答
  •  耶瑟儿~
    2021-02-01 04:38

    Memory leaks are never OK in any program, however small it may be. Slowly they will add up to fill up your entire memory. Suppose you have a calling system which leaks about 4 bytes of memory per call it handles. You can handle say, 100 calls a second (this is a very small number), so you end up leaking 400 bytes a second or 400x60x60(1440000B) an hour. So, even a small leak is not acceptable. And if you dont know the source of the leak then it may be some real big issue and you end up having buggy software. But, essentially it boils down to the questions like, for how much time the program runs and what number of times the leak happens. So, it may be ok it leaks a very small amount and is not repeated but still the leak may be a small part of a bigger problem. So, I feel that memory leaks are never ok.

提交回复
热议问题