Gentoo Archives: gentoo-user

From: Ashley Dixon <ash@××××××××××.uk>
To: gentoo-user@l.g.o
Subject: Re: [OBORONA-SPAM] Re: [gentoo-user] Is Gentoo dead?
Date: Sat, 25 Apr 2020 18:28:29
Message-Id: 20200425182819.lh4son6zvenx5drq@ad-gentoo-main
In Reply to: Re: [OBORONA-SPAM] Re: [gentoo-user] Is Gentoo dead? by Caveman Al Toraboran
1 On Sat, Apr 25, 2020 at 04:37:43PM +0000, Caveman Al Toraboran wrote:
2 > so i really can't believe that we have devolved in
3 > such a way where malloc/free suddenly has became a
4 > hard concept for homo sapiens.
5
6 You'd be surprised how much shocking code is out there, especially in
7 proprietary products (the Valve Steam Client is a prime example).
8
9 In general, reasons for memory-management-incompetence fall into the following
10 categories:
11
12 (a) Programmers forget. For experienced and skilled developers, this is
13 likely the most common cause of malloc-free mismatches. I was
14 programming in C a few years before I ever touched a computer (I
15 bought/stole Kernighan and Ritchie from the local library and
16 wrote out code-listings with pencil and paper), and to this day
17 still occasionally forget to free everything I malloc.
18 Thankfully, in the days of dynamic code-analysis tools such as
19 Valgrind, these problems---amongst other hard-to-spot
20 issues---become easy fixes.
21
22 (b) Programmers don't care, because it is assumed the operating system
23 will do it for them. I have heard this one quite a bit from
24 people trying to justify their horribly written code. Often,
25 with people who make this argument, the malloc-free mismatch is
26 the least of their problems, however in the days of intelligent
27 operating system-level memory-management seen in modern Linux
28 kernels, some programmers seem to take the hard work of kernel
29 developers as a free pass to be messy themselves.
30
31 (c) Programmers don't care, because the code means nothing to them. I
32 have never worked as a professional programmer, so I can only
33 speculate, but from conversations with veteran developers at
34 large companies such as Intel and Microsoft, it seems as though
35 the general morale amongst older developers can drop hugely. Why
36 bother optimising or thoroughly testing code when it's not
37 yours, and you don't really care about the company for whom
38 you're developing ?
39
40 (d) Programmers are genuinely unaware of the importance of freeing their
41 malloc'd objects. With the abundance of terrible on-line
42 tutorials, written by teachers that seem to devote themselves to
43 teaching the worst practices possible, I've seen an influx of
44 programmers who are simply unaware of the need to free their
45 memory pools. It takes less than a minute of on-line searching
46 to find a popular tutorial on some pretty website which shows
47 code leaking memory.
48
49 So yes, it is easy to understand, but whether people _care_ or even know in the
50 first place is entirely up to them.
51
52 --
53
54 Ashley Dixon
55 suugaku.co.uk
56
57 2A9A 4117
58 DA96 D18A
59 8A7B B0D2
60 A30E BF25
61 F290 A8AA

Attachments

File name MIME type
signature.asc application/pgp-signature