[fpc-devel] Why/how does the compiler have a non-trivial numberof memory leaks after over two decades of development?
J. Gareth Moreton
gareth at moreton-family.com
Thu Aug 2 20:32:08 CEST 2018
Well, I'm only a volunteer developer, but I'm all for making the compiler
more efficient and stable. I tend to take the approach of iterative
improvement anyway... start with something quick and dirty (if you can't
easily plan it out perfectly from the start), and slowly improve it over
time.
Gareth aka. Kit
On Thu 02/08/18 19:39 , Ben Grasset operator97 at gmail.com sent:
I'm somewhat surprised to see all the mentions of try-finally in
response to this.
The issues I found and described here are all clearly just simple cases
of variables being created and then never freed. Part of what likely
leads to this is that the compiler relies in many places on checking
whether or not things are currently nil, and heavily reuses global
variables for this purpose.
So it's quite likely in my opinion that there's places where things are
in fact being set to nil without actually being freed first, which has
the potential to go beyond basic leaks and actually lead to memory
corruption problems than could cause real compiler bugs (and might
already be doing so.)
I really don't think that try/finally is particularly relevant for this
kind of thing, nor would it be good for compiler performance. I do think
however that it's quite viable to get some kind of system in place in
the compiler codebase (hidden behind one of the debug-related ifdefs so
that it never affects normal compiler builds at all) that would allow
for much easier soundness-checking while working on the compiler than
HeapTrace can provide on its own.
I've been trying out a few different approaches in the last few days,
and if there's any interest in something like this from the compiler
team I might post here for feedback once I get something more concrete
worked out.
_______________________________________________
fpc-devel maillist - fpc-devel at lists.freepascal.org [1]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
[2]">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Links:
------
[1] mailto:fpc-devel at lists.freepascal.org
[2] 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/20180802/385bc67b/attachment.html>
More information about the fpc-devel
mailing list