From owner-freebsd-questions@FreeBSD.ORG Tue Mar 29 07:26:05 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A048C106566C for ; Tue, 29 Mar 2011 07:26:05 +0000 (UTC) (envelope-from demelier.david@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id A67C38FC13 for ; Tue, 29 Mar 2011 07:26:04 +0000 (UTC) Received: by bwz12 with SMTP id 12so3794571bwz.13 for ; Tue, 29 Mar 2011 00:26:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :subject:content-type:content-transfer-encoding; bh=C3WFFCs6iO8fPG8K0nuMZjUV/bBrVsnq0D6p2VqGpFU=; b=gNDaI7ypElgy/neU69Pppmcwfrj4kVqQa+WuDQgY4PAwqvlHnVkPnsq4OVTJ60tdNy qu7tsLUJVh7gxel7vKzV4VSKHVlVu1yiQUe6EwUpYz0QkE7FW5Wp0F386QcsGX6/Cx7p laK4HSp14yVZCH7yDWl8NhP/sz6UqTfZa/YUs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=H6LEFwK3kupPaLCQz4CGruNw/R4KDWBFhSrRwhkfopjg7/UcZ/LYbeK+AwArwZEye8 VzHw8NhOUUeU1Nys0DtKhlZDPbmUsp35zPD1T7hmi5Sf7IHKZ9xPqmIyNfRs+BcE2XaE IGiD07S5kYvON6HjoGDImRRdCIOtIlr4d4+Qk= Received: by 10.204.16.140 with SMTP id o12mr4425933bka.125.1301383563428; Tue, 29 Mar 2011 00:26:03 -0700 (PDT) Received: from Melon.malikania.fr (wifi-osiris-sec-183-249.u-strasbg.fr [130.79.183.249]) by mx.google.com with ESMTPS id b6sm3194207bkb.10.2011.03.29.00.26.01 (version=SSLv3 cipher=OTHER); Tue, 29 Mar 2011 00:26:02 -0700 (PDT) Message-ID: <4D918988.8090802@gmail.com> Date: Tue, 29 Mar 2011 09:26:00 +0200 From: David Demelier User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.15) Gecko/20110306 Thunderbird/3.1.9 MIME-Version: 1.0 To: freebsd-questions@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: printf() leak? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Mar 2011 07:26:05 -0000 Hello, It seems printf() always alloc something and does not free it: #include #include int main(void) { printf("Hi\n"); return 0; } and valgrind ./a.out: ==67840== ==67840== HEAP SUMMARY: ==67840== in use at exit: 4,096 bytes in 1 blocks ==67840== total heap usage: 1 allocs, 0 frees, 4,096 bytes allocated ==67840== ==67840== LEAK SUMMARY: ==67840== definitely lost: 0 bytes in 0 blocks ==67840== indirectly lost: 0 bytes in 0 blocks ==67840== possibly lost: 0 bytes in 0 blocks ==67840== still reachable: 0 bytes in 0 blocks ==67840== suppressed: 4,096 bytes in 1 blocks (The experience on Linux does not leak) Cheers, -- David Demelier