Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Re: tlug-digest Digest V2004 #194



Quoth Jim Breen (Thu 2004-07-29 12:24:06PM +1000):

> Brett Robson <b-robson@example.com> wrote:
>
> >> Yes, these are the most common reasons.
> >>
> >> 1. A programme when it finishes using a bit of memory doesn't release it
> >> or the release fails
> >> 2. Doesn't remember that is already has memory and askes again
> >>
> >> The language C is notorious for these problems.
>
> The "language C" doesn't have those problems. Programs written in
> low-level languages by sloppy programmers have those problems. If you
> try hard enough you can program a memory grabber in almost anything.
> C just exposes the machinery more, making it a tad easier for idiots to
> stuff things up.

Agreed, though in the defence of C programmers, memory management is a
terrifically difficult thing to get right for all but the most trivial of
cases.

I like to code in C, but I always heave a sigh of relief when I finish up
something in C and start something in Perl, for now I don't have to worry
about such low-level stuff as memory management.

I have come to be of the opinion that C should be avoided for all but the
most systemsy of software. Write your stuff in a higher-level language,
and rewrite the inner loops in C where blazing speed is necessary. Most
high-level languages allow you to inline other lanugages (hell, C allows
you to inline assembly!).

In any case, Brett, I think that it is safe to say that (1) is the only
reason for a memory leak, and (2) is a thing that often leads to (1).

-- 
Josh Glover

Gentoo Developer (http://dev.gentoo.org/~jmglov/)
Tokyo Linux Users Group Listmaster (http://www.tlug.jp/)

GPG keyID 0xDE8A3103 (C3E4 FA9E 1E07 BBDB 6D8B  07AB 2BF1 67A1 DE8A 3103)
gpg --keyserver pgp.mit.edu --recv-keys DE8A3103

Attachment: pgp00065.pgp
Description: PGP signature


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links