From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25214 invoked by alias); 22 Aug 2003 20:49:22 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 25187 invoked from network); 22 Aug 2003 20:49:10 -0000 Received: from unknown (HELO mail.inka.de) (193.197.184.2) by sources.redhat.com with SMTP; 22 Aug 2003 20:49:10 -0000 Received: from raven.inka.de (uucp@[127.0.0.1]) by mail.inka.de with uucp (rmailwrap 0.5) id 19qIqK-0003qA-00; Fri, 22 Aug 2003 22:49:08 +0200 Received: from localhost (localhost [127.0.0.1]) by raven.inka.de (Postfix) with ESMTP id 50F5E1C8 for ; Fri, 22 Aug 2003 22:48:45 +0200 (CEST) Received: by raven.inka.de (Postfix, from userid 500) id 067EF1C9; Fri, 22 Aug 2003 22:48:45 +0200 (CEST) Date: Fri, 22 Aug 2003 20:49:00 -0000 From: Josef Wolf To: gdb@sources.redhat.com Subject: Why malloc() when target code is executed? Message-ID: <20030822204844.GC14466@raven.inka.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i X-Virus-Scanned: by AMaViS snapshot-20020531 X-SW-Source: 2003-08/txt/msg00262.txt.bz2 Hello! I just noticed that ``print printf("Hello\n")'' call malloc() on the target to allocate the memory for the string. AFAICS, this memory never gets freed. Is there any reason not to allocate this memory on the stack? This would avoid this memory leak. In addition, this would make it possible to use this feature on embedded systems which often have either restricted memory or even dont have malloc() at all. -- Please visit and sign http://petition-eurolinux.org and http://www.ffii.org -- Josef Wolf -- jw@raven.inka.de --