From owner-freebsd-chat Fri Aug 7 22:22:26 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id WAA02073 for freebsd-chat-outgoing; Fri, 7 Aug 1998 22:22:26 -0700 (PDT) (envelope-from owner-freebsd-chat@FreeBSD.ORG) Received: from ns.mt.sri.com (sri-gw.MT.net [206.127.105.141]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id WAA02068 for ; Fri, 7 Aug 1998 22:22:25 -0700 (PDT) (envelope-from nate@mt.sri.com) Received: from mt.sri.com (rocky.mt.sri.com [206.127.76.100]) by ns.mt.sri.com (8.8.8/8.8.8) with SMTP id XAA27269; Fri, 7 Aug 1998 23:22:01 -0600 (MDT) (envelope-from nate@rocky.mt.sri.com) Received: by mt.sri.com (SMI-8.6/SMI-SVR4) id XAA23668; Fri, 7 Aug 1998 23:21:59 -0600 Date: Fri, 7 Aug 1998 23:21:59 -0600 Message-Id: <199808080521.XAA23668@mt.sri.com> From: Nate Williams MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: Wes Peters Cc: Nate Williams , Terry Lambert , jdp@polstra.com, chat@FreeBSD.ORG Subject: Re: Heads up on LFS In-Reply-To: <35CBD340.86A928C9@softweyr.com> References: <199808071637.KAA19141@mt.sri.com> <199808072218.PAA01251@usr02.primenet.com> <199808072250.QAA22022@mt.sri.com> <35CBD340.86A928C9@softweyr.com> X-Mailer: VM 6.29 under 19.15 XEmacs Lucid Sender: owner-freebsd-chat@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > > *Right* And you've never written a program that leaked memory, nor had > > *any* errors due to malloc/free problems, or dealt with them. > > > > If you can say that every program you ever written that used dynamic > > memory has never had problems, then I don't believe you. ... > I have written *several* programs, systems really, that don't leak > memory. I never said it couldn't be done, I said that it isn't *always* done, and it takes alot of time/effort to do right. > We prove this by running them at 95+% usage for 30 days at a time and > monitor the memory usage. Since these are embedded systems, if they leak, > they eventually crash. It is *not* true that every C or C++ program > leaks memory, as each of these systems was implemented in C and/or C++ > (running on VxWorks). I'm sorry if I made the impression that it's impossile to right a correct program. However, it is difficult to do so, so *very few* programs behave 100% correctly, especially so when you use C++, which makes it really easy to leak memory if you use some of the more esoteric features. Basically, you're helping make my point. It's *hard* to write 100% correct highly dynamic *real* systems using malloc/free. However, it's *MUCH EASIER* to write 100% correct highly dynamic programs using a GC system. The same problems plague both of them in embedded systems (wanting a resource and it not there to get), but the GC version has an advantage of being eaiser to get right w/out trying real hard, and the C/C++ version has the advantage of being *slightly* better at managing resources if you try *real* hard. If you're willing to work that hard for your performance, why not use hand-coded assembly. It's essentially the same thing. If you need the absolute bare-metal performance, then the only way to get it is to get down to the bare-metal. The choice of memory allocations is so far up on the list of things to worry about that it's simply not worth worrying (or for that matter arguing) about. Nate To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-chat" in the body of the message