[MSEide-MSEgui-talk] fpc and memory leak.

classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

[MSEide-MSEgui-talk] fpc and memory leak.

fredvs
Hello.

Referencing to this:
http://lists.freepascal.org/pipermail/fpc-devel/2018-July/039369.html

So, if I understand ok, after few compiling, we have to reboot the system
because fpc has eaten lot of memory because of their memory leaks ?

Huh, will MSElang have the same behaviour ?

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] fpc and memory leak.

Marcos Douglas B. Santos
On Tue, Jul 31, 2018 at 12:48 PM, fredvs <[hidden email]> wrote:
> Hello.
>
> Referencing to this:
> http://lists.freepascal.org/pipermail/fpc-devel/2018-July/039369.html
>
> So, if I understand ok, after few compiling, we have to reboot the system
> because fpc has eaten lot of memory because of their memory leaks ?
>
> Huh, will MSElang have the same behaviour ?

You don't need to reboot the system.
When the process finish, the OS clean all memory that belongs it.

regards,
Marcos Douglas

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] fpc and memory leak.

fredvs
Thanks Marcos.

> When the process finish, the OS clean all memory that belongs it.

Sorry, I do not understand.
Do you mean that the OS clean all memory leak after fpc is closed?
What OS ?

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
mse
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] fpc and memory leak.

mse
Administrator
In reply to this post by fredvs
On 07/31/2018 05:48 PM, fredvs wrote:

> Hello.
>
> Referencing to this:
> http://lists.freepascal.org/pipermail/fpc-devel/2018-July/039369.html
>
> So, if I understand ok, after few compiling, we have to reboot the system
> because fpc has eaten lot of memory because of their memory leaks ?
>
> Huh, will MSElang have the same behaviour ?
>
No, MSElang compiler has no memory leaks. I always test with heaptrace.
MSElang compiler also tries to minimize memory consumption while
compiling, it does not use classes for "abstract syntax tree" and other
low level purpose, it not even has an abstract syntax tree...

Martin

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
mse
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] fpc and memory leak.

mse
Administrator
In reply to this post by fredvs
On 07/31/2018 06:25 PM, fredvs wrote:
> Thanks Marcos.
>
>> When the process finish, the OS clean all memory that belongs it.
>
> Sorry, I do not understand.
> Do you mean that the OS clean all memory leak after fpc is closed?

Yes.

> What OS ?
>
Linux, FreeBSD, Windows and OSX for sure.

Martin

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] fpc and memory leak.

Marcos Douglas B. Santos
On Tue, Jul 31, 2018 at 2:14 PM, Martin Schreiber <[hidden email]> wrote:

> On 07/31/2018 06:25 PM, fredvs wrote:
>> Thanks Marcos.
>>
>>> When the process finish, the OS clean all memory that belongs it.
>>
>> Sorry, I do not understand.
>> Do you mean that the OS clean all memory leak after fpc is closed?
>
> Yes.
>
>> What OS ?
>>
> Linux, FreeBSD, Windows and OSX for sure.

Thanks Martin.

@fredvs
Do not confuse with your application running.
We're talking about fpc process. It will compile your code making a
lot of memleak... then the fpc process die and the memleak is gone.
But you need paying attention if your code is producing memleaks.
However, if your application is just a console app that do the job and
dies, as FPC, then it will be the same.
Nevertheless, I always (try) clean my objects, checking with heaptrc.
It does'nt matter if is a console, Desktop, Web.

regards,
Marcos Douglas

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] fpc and memory leak.

fredvs
@ Marcos and Douglas: thanks for your light.

> However, if your application is just a console app that do the job and
> dies, as FPC, then it will be the same.

Huh, AFAIK MSE and fpGUI apps are console apps too ?

Anyway, in my old time, playing with programing gives you a red card when
your code generated a memory leak.

But time has changed and maybe memory is not so rare and precious than
before.
Like explained in fpc mailing-list, what is important now is speed and no
matter for some memory leak if it makes code faster.

> evertheless, I always (try) clean my objects, checking with heaptrc.
> It does'nt matter if is a console, Desktop, Web.

Me too, always.

Fre;D





--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] fpc and memory leak.

Marcos Douglas B. Santos
On Tue, Jul 31, 2018 at 7:42 PM, fredvs <[hidden email]> wrote:
> @ Marcos and Douglas: thanks for your light.
>
>> However, if your application is just a console app that do the job and
>> dies, as FPC, then it will be the same.
>
> Huh, AFAIK MSE and fpGUI apps are console apps too ?

Yes, but AFAIK these apps do not have memleaks.

> Anyway, in my old time, playing with programing gives you a red card when
> your code generated a memory leak.
>
> But time has changed and maybe memory is not so rare and precious than
> before.

Nothing has changed. If your code has memleaks, something is wrong. Period.

> Like explained in fpc mailing-list, what is important now is speed and no
> matter for some memory leak if it makes code faster.

That are their thinking...
You cannot use this "approach" for apps that could stay running
"forever" like web apps on the server, DLLs, even a desktop apps that
users don't close. Memleaks, in that cases, will be a problem for
sure.

regards,
Marcos Douglas

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] fpc and memory leak.

fredvs
>That are their thinking...

All that story gives me, one more time, a taste of disrespect on the part
fpc core developers.

And,sorry, but for me respect is paramount.

Thanks for your positive view Marcos.

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] fpc and memory leak.

fredvs
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.

Thanks.

Fre;D




--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] fpc and memory leak.

Sieghard
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] fpc and memory leak.

fredvs
Hello Seighard.

Many thanks for that **clear** explanation how the OS work when a program
close and what appends with the "memory leak".

But the question was about what appends **inside** the program-process (all
what appends before the program close).

This to try to understand why with fpc, for big project like compiling fpc
him-self, the memory used do not stop to increase and the speed of
compilation  decrease.

Fre;D  



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] fpc and memory leak.

Sieghard
Sehr geehrter Herr fredvs,

Sie schrieben am Mon, 3 Dec 2018 03:27:53 -0600 (CST):

> Many thanks for that **clear** explanation how the OS work when a program
> close and what appends with the "memory leak".
>
> But the question was about what appends **inside** the program-process
> (all what appends before the program close).

Well, I think that nothing will append anything to anything else within the
program, if no memory has been requested from the OS to append to its local
pool. And when the program closes, what do you think should specifically
happen to anything _within_ the program that affects anything still
noticable? When the program closes down, it ceases to interact with its
environment, and so it may do whatever the programmer deemed useful or
neccessary, without any external effect.

> This to try to understand why with fpc, for big project like compiling fpc
> him-self, the memory used do not stop to increase and the speed of
> compilation  decrease.

I cannot see what relevance your question has to this. Memory "used" by
the program as reported by an OS function does _not_ in any way relate to
anything happening _within_ the program - specifically it does not relate
to the degree of internal use of the allocated memory. You might gain
access to that only through the use of debugging or reporting functions
built into the program itself, i.e. by "instrumenting" the program
accordingly.

If you're wondering whether fpcs (internal? external?) use of memory does
not increase and the speed of compilation does not decrease, then this
might - will - be due to careful memory management and thoughtful code
optimization. After all, it depends the least on anything going on when
it's done with its task an closing down to finally exit.

--
--
(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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] fpc and memory leak.

fredvs
Thanks Seighard.

>> This to try to understand why with fpc, for big project like compiling
>> fpc
>> him-self, the memory used do not stop to increase and the speed of
>> compilation  decrease.

> I cannot see what relevance your question has to this.

Hum, in the fpc-forum, to justify the memory leaks generate during
fpc-compilation, some people argued that the reason is speed.
They said that not releasing memory will speed-up the compilation and all
memory leaks will be rmoved by the OS when the application close.

OK, I understand the argument but I have still doubt.
Maybe it can speed up the compilation if there is big memory available, so
memory leak is not relay a problem but if the RAM is short, will it no be a
moment when nearly all the memory is allocated and so make the process
slower?

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] fpc and memory leak.

Sieghard
Sehr geehrter Herr fredvs,

Sie schrieben am Tue, 4 Dec 2018 08:00:45 -0600 (CST):

> >> him-self, the memory used do not stop to increase and the speed of
> >> compilation  decrease.  
>
> > I cannot see what relevance your question has to this.  
>
> Hum, in the fpc-forum, to justify the memory leaks generate during
> fpc-compilation, some people argued that the reason is speed.

Well - in some respect, this may be true. Not careing to clean up, i.e. not
_doing_ clean up work, will be, albeit just a little, faster than doing so.
If you leave the "mess" on your desktop after doing some work and start zhe
next thing just on top of it, you _will_ save a couple of seconds every
time. (Although you cannot usually just dump all accumulated litter into
your trash can in the evening when you leave from work, which would be the
equivalent of reusing the memory after a program has terminated.)

> They said that not releasing memory will speed-up the compilation and all
> memory leaks will be rmoved by the OS when the application close.

Yes, that's just what I stated above - omitting clean up saves a little
time everytime, and on termination, all memory goes back to the system
anyway. It's "just" the difference between a program that's friendly
against others running concurrently, leving comfortyble space for all of
them, and a "memory hog" that ploughs through all of the available memory,
displacing anything else in need for a chunk, and possibly slowing down
all processing by driving the system into using swap space.

> OK, I understand the argument but I have still doubt.
> Maybe it can speed up the compilation if there is big memory available, so
> memory leak is not relay a problem but if the RAM is short, will it no be
> a moment when nearly all the memory is allocated and so make the process
> slower?

Yes, that is just how it works. The argument "in favor" of this way is
"meory is cheap as dirt these days". A faulty argument at any time, I think.

--
--
(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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] fpc and memory leak.

fredvs
Hello Sieghard.

OK, we are totally on same feeling.

Thanks for your clear explanations (and I hope that one day fpc-developers
will take a beak and clean-up all their memory leaks)..

Huh, where is Martin, everything OK ?

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


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