int main() {
int eger = new int;
}
Is this a memory leak? I know it probably would have been just plain good practice to simply do this instead:
int main() {
int eger = new int;
delete eger;
}
But suppose you don''t, doesnt the OS get the memory back when your program terminates anyway? In other words, even though this program technically has a memory leak, couldnt you run this infinetly many times without problem because the OS will get the memory back at the end of each run?
Or does it depend on which OS you are using? If it depends on the OS, then how does Windows behave? How does Linux behave?
Thanks.