From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24938 invoked by alias); 5 Feb 2011 12:51:30 -0000 Received: (qmail 24930 invoked by uid 22791); 5 Feb 2011 12:51:30 -0000 X-SWARE-Spam-Status: No, hits=1.1 required=5.0 tests=AWL,BAYES_00,DNS_FROM_RFC_BOGUSMX,SARE_HEAD_XWORD,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from caprica.metux.de (HELO mailgate.caprica.metux.de) (82.165.128.25) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 05 Feb 2011 12:51:23 +0000 Received: from mailgate.caprica.metux.de (localhost.localdomain [127.0.0.1]) by mailgate.caprica.metux.de (8.14.4/8.14.4) with ESMTP id p15Clxti020108 for ; Sat, 5 Feb 2011 13:48:00 +0100 Received: (from uucp@localhost) by mailgate.caprica.metux.de (8.14.4/8.14.4/Submit) with UUCP id p15ClXl9020080 for gcc-help@gcc.gnu.org; Sat, 5 Feb 2011 13:47:33 +0100 Received: (from weigelt@localhost) by nibiru.metux.de (8.12.10/8.12.10) id p15CfexS006797 for gcc-help@gcc.gnu.org; Sat, 5 Feb 2011 13:41:40 +0100 Date: Sat, 05 Feb 2011 14:37:00 -0000 From: Enrico Weigelt To: gcc-help@gcc.gnu.org Subject: Re: C++ and garbage collection Message-ID: <20110205124139.GB29367@nibiru.local> Reply-To: weigelt@metux.de Mail-Followup-To: gcc-help@gcc.gnu.org References: <20110204194604.GB12837@nibiru.local> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.1i X-Terror: bin laden, kill bush, Briefbombe, Massenvernichtung, KZ, X-Nazi: Weisse Rasse, Hitlers Wiederauferstehung, 42, X-Antichrist: weg mit schaeuble, ausrotten, heiliger krieg, al quaida, X-Killer: 23, endloesung, Weltuntergang, X-Doof: wer das liest ist doof X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2011-02/txt/msg00118.txt.bz2 * Lawrence Crowl wrote: > If your problem is leaking memory, and you aren't playing games > with your pointers, then you can just add in the Boehm collector, > leaving the deletes in place. This approach will leave the program > working pretty much as before, but with less memory. > > If your problem is using objects after you have freed them, then you > have a much harder problem. I simply want to get rid of the whole deallocation issue at all (never having to care about this anymore, making the code smaller and so easier to maintain). > Many C++ programs do real work in the destructors (like closing > files) and removing the delete operations would disable that code. As said in my prev. mail: these are only few cases where this matters (files on external storages which are mounted/unmounted by the application) - these are only few, well known places, which I easily could refactor. > One viable approach is to modify the uses of pointers into shared_ptr > (from TR1 or boost) and then add the Boehm collector. This process > takes work, because changing all pointers won't work and changing > none won't buy you anything. Guess this would take a lot of work and add more dependencies (than just the relatively small boehm-gc lib) ... cu -- ---------------------------------------------------------------------- Enrico Weigelt, metux IT service -- http://www.metux.de/ phone: +49 36207 519931 email: weigelt@metux.de mobile: +49 151 27565287 icq: 210169427 skype: nekrad666 ---------------------------------------------------------------------- Embedded-Linux / Portierung / Opensource-QM / Verteilte Systeme ----------------------------------------------------------------------