When trying to cut down possible memory leaks in my program, I noticed a reoccoring pattern: Move Delete closer to new, repeat, remOve the function that uses it and move code to main, move a few things to global, replace some stuff with arguments and return values, and in the end everything is in main with no pointers.
However to reassure myself that this wont have problems I want to know this : If my program doesnt use the stack or heap at all (as in me putting a new or stk()? in it) will it still have (however small) memory leaks? It was made to work forever constantly recalculating it's output every second, evaluating the time, year, day, ticks since start, CPU speed (<<in progress), so basically if you open this in DOS your doomed.
Jump to Post
Use the standard smart pointers, perhaps?
Jump to Post
If my program doesnt use the stack or heap at all (as in me putting a new or stk()? in it) will it still have (however small) memory leaks?
If you don't create leaks, or use any libraries that create leaks, then it stands to reason that there won't be …
All 9 Replies
We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.