[fpc-devel] Why/how does the compiler have a non-trivial numberofmemory leaks after over two decades of development?

J. Gareth Moreton gareth at moreton-family.com
Mon Jul 30 21:40:37 CEST 2018


 As mentioned before, the main problem with try...finally blocks is that
they incur a massive speed penalty, so they're not things you want to enter
and exit on a frequent basis. Whether that means we need to work on the
compiler so it reduces this penalty on such blocks (such as internally
removing the construct and copying the code in the 'finally' section into a
local exception handler) I'm not sure.

 I do agree though that we should manage memory with care, especially as
Pascal gives us such fine control over it (compared to, say, C++'s RAII
feature which is a little nebulous at times with its garbage collection). 
I think first though we need to fix any obvious memory leaks, namely
objects and blocks of memory that we forget to free, then build up from
there.  At least that will help reduce the risk of an out of memory
situation during normal operation.

 Gareth aka. Kit

 On Mon 30/07/18 21:27 , "Marcos Douglas B. Santos" md at delfire.net sent:
 On Mon, Jul 30, 2018 at 3:31 PM, R0b0t1  wrote: 
 > On Mon, Jul 30, 2018 at 11:42 AM, Marcos Douglas B. Santos 
 >  wrote: 
 >> On Mon, Jul 30, 2018 at 12:29 PM, R0b0t1  wrote: 
 >> 
 >> [...] 
 > 
 > If a program isn't long running I see programmers tend to not care 
 > about memory management, nor do I make a habit of caring about it 
 > myself. I find it hard to see anything wrong with this. 
 > 
 > As someone has mentioned this can fail on smaller computers, but how 
 > much RAM is too little? SBCs now typically come with 1-4GB of memory. 

 I'm sorry, but we work with a language that expected programmers 
 should manage their objects. 
 The language even provides a clean way (try-finall) to do that. 
 I use try-finally even to write a snippet to show an example of code... 

 IMO, that must be a habit in such languages. 

 regards, 
 Marcos Douglas 
 _______________________________________________ 
 fpc-devel maillist - fpc-devel at lists.freepascal.org [4] 
 http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
[5]">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel 

 

Links:
------
[1] mailto:r030t1 at gmail.com
[2] mailto:md at delfire.net
[3] mailto:r030t1 at gmail.com
[4] mailto:fpc-devel at lists.freepascal.org
[5] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20180730/f014fde3/attachment.html>


More information about the fpc-devel mailing list