You could go and look at the memory.
Surely, you jest.
In any event, magnetic core was slightly before my time.
Iām old, but not ancient.
Youād need a very big magnifying glass
Without getting too technical, what is a memory leak?
Itās when the code is mis-written so that it never gives allocated memory back to the memory pool when it is no longer in use. Eventually, the process runs out of available memory.
Thanks. You answered my second question I was going to ask. Is it cumulative? Yes.
They can be a bugger to find.
Nope. This was 2007, on a āmodernā Unix operating system (MacOS).
- A user complained that a website this machine was running was misbehaving.
- Looking at the httpd logs, the problem seemed to be in a certain CGI script.
- I opened the CGI script in a text editor to see what the problem was
- By some miracle, it was mapped to the bad location in memory.
- I added an inconsequential debugging message at one place in the file, and saved the file.
- All hell broke loose, as Perl complained about errors in the file.
- I looked at the file again, and found that some code that Iād never edited had changed.
The rest of the story, Iāve already told you.
Correct.
From the userās point of view, the program in question gradually uses more and more memory ā¦ until itās either restarted or it gobbles up all of the available memory (and bad things happen).
Your solution, of frequently rebooting the machine, is a good workaround when thereās a memory leak.
Indeed!
I wondered whether modern languages had tools to preclude or detect memory leaks, and they do. Automatic garbage collection is not, however, a panacea.
C++ also addresses the problem by releasing the memory allocated to variables, when that variable goes āout of scopeā
C# tried to go further and do automatic garbage collection on allocated memory, with various degrees of success.
At least, thatās my memory.