Sehr geehrter Herr fredvs,

Sie schrieben am Sun, 2 Dec 2018 13:39:40 -0600 (CST):

> Hello.
> 
> Sorry to come back with this old story but there are things still not
> clear for me.
> 
> In previous posts you explained that now nearly all modern OS have a
> "cleaning team" who frees all memory-leaks that was left when a
> application close.
> 
> Perfect but what about the memory-leak generated inside process done in
> the application?
> For example if the application call methods that create objects but not
> free it at exit?
> 
> Is there also a OS "cleaning team" that clean the memory leak?
> 
> If no, could that explain why, for compiling large applications (like
> compiling fpc himself), the memory used dont stop to increase and the
> speed of compilation decrease (because less memory available) ?
> 
> Not very important but I like to understand how things work.

Well, this _is_ important, but the explanation ist very simple and trivial.

First, there is _no_ OS "cleaning team" to remove "memory leaks".
Memory leaks are just chunks of memory alotted to a processes working
memory as registered by the OS, but no longer used by the process. These
chunks of memory could be "freed" by the process, i.e. could possibly be
made available to the OS while it is still running without affecting the
programs function.
Now, on program termination, the program just signals the OS that it is
done - it "exits". At that point, the OS removes it from its internal
tables ("process table"), i.e. clears the program entry points where it was
called for scheduling or signalling, and declares all of the programs
memory available to other uses again, disregarding any remnamts of the
programs working, which may simply remain there (giving spy software the
ability to find possibly "sensitive" data), or the OS may even clear all of
this memory immediately or before putting it to another use.
Thus, there's no _need_ for an OS "cleaning team" - the memory is just
recovered because it's no longer in use for the program.

But - there _are_ possible leaks even for the OSes memory. OSes could
provide the ability for programs to allocate memory for global use, i.e.
for other programs also (Linux' "shm", e.g.) or for passing data to later
running programs or for later use by another invocation of themselves.
_These_ memory areas are kept even after program termination and might have
to be cleared explicitely. But this is no longer normal use by simple
standard programs.

-- 
-- 
(Weitergabe von Adressdaten, Telefonnummern u.ä. ohne Zustimmung
nicht gestattet, ebenso Zusendung von Werbung oder ähnlichem)
-----------------------------------------------------------
Mit freundlichen Grüßen, S. Schicktanz
-----------------------------------------------------------




_______________________________________________
mseide-msegui-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to