Home java What is a memory leakage and why does it happen?

What is a memory leakage and why does it happen?

Author

Date

Category

tee what? Some part of the code or information located in the variable?


Answer 1, Authority 100%

If on your fingers:

All programs within the most popular OS are a particularly structured set of data and instructions. OS knows how to work with these data sets and instructions, and does it in some initiate order. As part of the OS for this, there is an object – a process that will load the instructions and data prepared by the developer and data, to highlight the processor time under them, generate other objects of the OS kernel, which are also doing something.

The instructions themselves can also interact with different entities of the operating system, the file system, generate streams, with the periphery, output something on the screen, interact when working with RAM. All these resources, or many of them are shared. For example, output to the screen, because The screen is one. Or work with memory, because Its final number. And all this is done through the OS API directly, or through some wrappers above this API OS.

and once the memory can be allocated, it should be released, i.e. Notify the OS that this section is “free”, and can be given to any other process under his needs. Control over, whether the program needs another memory to be at the discretion of the program, it is natural, not manages.

and once the management of the program selected on the program is on the side of the program, the program can be built so that it will sometimes notify the OS on it to allocate it some kind of memory, but not notify the release.

In the cycle, this leads to the fact that over time the amount of memory used is used to grow infinitely.

Some funds with which the developer interacts with the API API themselves can determine that one or another area of ​​memory can be released, and some do not know how.
In Java, this is engaged in the abstraction “garbage collector”.
In C++ control of this entirely on the side of the developer.


Answer 2, Authority 29%

Memory leakage – Wikipedia .

Memory leakage (eng. MEMORY LEAK) – the process uncontrollable
Reducing the volume of free operational or virtual memory
computer associated with errors in working programs is not on time
release unnecessary parts of memory, or with system errors
Memory Control Services.

Something concrete from this is not clear?


Answer 3, Authority 29%

This is when you set the pointer to a specific section of memory, and then I did not release it and changed the pointer to another section of the memory.
As a result, you lost access to the dedicated area of ​​memory. This is the name of the memory leak.
And as they wrote above. If you constantly request the program from the OS memory and do not release, in the end, it may go to the point that the OS will not remain free RAM. The computer will start buggy. And you have to reboot. Well, if it is completely straight and stupid text to write.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions