w00d
w00d

Reputation: 5596

C++ can memory leak lead to memory error?

"Memory error" in the title means the type of error that can cause the program to crash or corrupt managed memory.

To make it clearer, also assume memory full is not this type of "memory error".

Thanks

Upvotes: 0

Views: 304

Answers (3)

Over Killer
Over Killer

Reputation: 513

If leak will be big enough, yes it will.

Upvotes: 0

pm100
pm100

Reputation: 50190

if your leak causes you to run out of memory then one thing that can happen is that memory allocations will fail. If you are not correctly dealing with these failed allocations then all sorts of bad things can happen

But , in general, I would say that if you have memory corruption going on its not due directly to the leak. More likely the leak is irrelevant or the leak and the memory trashing are a symptom of a different bug

valgrind?

Upvotes: 3

Barry
Barry

Reputation: 19

Yes, it does. memory allocation will just allocate memory and when you are out of memory it will allocate memory which is in use.

If you are able to simulate your program in a simulator you can just put your function in a infinite while loop and check your task manager. if the task of your simulation is going up to tens of MB's there is certainly a leak in your memory.

Upvotes: -1

Related Questions