[SOLVED] What factors contribute to a memory leak?

ShangWang

Respectable
Mar 26, 2021
616
2
1,885
The only time I ever had a "memory leak" was when I had too many tabs opened at once, tried to run a game and ran out of memory so the game crashed. After that game was crashed it seemed to fail to release that memory.

Is the most common reason memory leaks happen is due to OOM issues, or are there other more common factors?
 
Solution
The only time I ever had a "memory leak" was when I had too many tabs opened at once, tried to run a game and ran out of memory so the game crashed. After that game was crashed it seemed to fail to release that memory.

Is the most common reason memory leaks happen is due to OOM issues, or are there other more common factors?
The ONLY thing that "causes" a memory leak is badly written code. That is why an end user can't do anything to fix it besides updating a program or driver. Only someone with the original source code can fix it.

USAFRet

Titan
Moderator
A 'memory leak' is when an application or function does not release whatever RAM it may be using.
Bad programming.

Say you have some application that checks in with home base every hour, for updates.
It uses some 100MB each time.
But when that function closes, it does not play well and give up that 100MB RAM.

Next hour, it cranks up that function, consuming another 100MB.
So, after having it open for 10 hours....that function is still holding that RAM. After 10 hours, it is sucking up 1GB RAM, for no good purpose.
 
  • Like
Reactions: ShangWang

kanewolf

Titan
Moderator
The only time I ever had a "memory leak" was when I had too many tabs opened at once, tried to run a game and ran out of memory so the game crashed. After that game was crashed it seemed to fail to release that memory.

Is the most common reason memory leaks happen is due to OOM issues, or are there other more common factors?
The ONLY thing that "causes" a memory leak is badly written code. That is why an end user can't do anything to fix it besides updating a program or driver. Only someone with the original source code can fix it.
 
  • Like
Reactions: ShangWang
Solution

ShangWang

Respectable
Mar 26, 2021
616
2
1,885
Any software can contain a memory leak. A device driver like a graphics card or network card driver execute small sections of code thousands of times per second. A tiny memory management error can quickly make a lot of memory unavailable.
I see, can a bad RAM stick itself cause memory leaks? I notice when I close all my tabs, then reopen all of the same ones I'm using 1GB less than before with the same tabs.