[fpc-devel] Why/how does the compiler have a non-trivialnumberofmemory leaks after over two decades of development?
J. Gareth Moreton
gareth at moreton-family.com
Mon Jul 30 19:49:26 CEST 2018
It might be a problem because it's a false error and not exactly clean.
Granted, testing such things is not that straightforward. Platforms such
as Windows do have a feature where you can tell it to randomly fail memory
allocations after about 8 minutes of start time (so the machine can fully
boot up) - the trouble is that graphical elements on the desktop stop being
rendered properly, among other failures, and you can't predict where an
allocation will fail in the program. I think you can put in exceptions so
allocations don't fail for Lazarus or the Command Prompt, for example.
The trouble is, these allocation failures are designed for C programs,
where "malloc" returns NULL if memory isn't allocated. Free Pascal's
GetMem raises an exception instead. Granted, it shouldn't be too much of
a struggle to implement a custom memory manager for testing and to cause
random (or deterministic) allocation failures to see how cleanly the
situation is handled. It could be a fun test suite!
It is times like these that give weight to being careful with memory
allocations. I started programming in the mid-90s where memory was still
quite tight (namely, a computer running Windows 95 with only 8 MB of
RAM!) While computers are very fast and spacious today, the same
standards still apply in places, notably in tight loops and functions that
get executed very frequently.
Gareth aka. Kit
On Mon 30/07/18 19:24 , "Anthony Walter" sysrpl at gmail.com sent:
I thought I'd add a point about compiling and memory. On the Raspberry Pi,
I know for a fact that building the compiler can fail after a
while due to insufficient memory. When this happens the problem with no
memory doesn't present itself as such. Rather you're left with an error
indicating a problem with the source. I've gotten around this problem by
making the compiler without a desktop environment running and re
configuring the swap size.
Might this problem be related in some way to the discussion in this
thread? _______________________________________________
fpc-devel maillist - fpc-devel at lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
[1]">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Links:
------
[1] 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/4c8515bd/attachment.html>
More information about the fpc-devel
mailing list