NetBSD Problem Report #45627
From martin@duskware.de Thu Nov 17 21:12:16 2011
Return-Path: <martin@duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by www.NetBSD.org (Postfix) with ESMTP id D9C3463D77E
for <gnats-bugs@gnats.NetBSD.org>; Thu, 17 Nov 2011 21:12:15 +0000 (UTC)
Message-Id: <20111117211215.D9C3463D77E@www.NetBSD.org>
Date: Thu, 17 Nov 2011 21:12:15 +0000 (UTC)
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@gnats.NetBSD.org
Subject: unclear memory leaks
X-Send-Pr-Version: 3.95
>Number: 45627
>Category: lib
>Synopsis: unclear memory leaks
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: lib-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Nov 17 21:15:00 +0000 2011
>Closed-Date: Fri Nov 18 13:50:41 +0000 2011
>Last-Modified: Fri Nov 18 13:50:41 +0000 2011
>Originator: Martin Husemann
>Release: NetBSD 5.99.56
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD krups.duskware.de 5.99.56 NetBSD 5.99.56 (MP3) #41: Thu Nov 17 20:22:24 CET 2011 martin@night-porter.duskware.de:/usr/src/sys/arch/sparc/compile/MP3 sparc
Architecture: sparc
Machine: sparc
>Description:
The below test program (intended to test for something else originally)
prints random 64bit numbers in an endless loop. It uses no dynamic
allocations once it enters the loop, nevertheless the program increases
its memory size constantly (and pretty fast). On a sparc with typical
memory configurations it gets killed after an hour or so.
>How-To-Repeat:
cc -O2 -Wall -o t_snprintf t_snprintf.c && ./t_snprintf
with t_snptrinf.c being:
--8<--
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include <time.h>
int main(int argc, char **argv)
{
union {
double d;
uint64_t bits;
} u;
uint32_t ul, uh;
time_t now;
char buf[1000];
time(&now);
srand(now);
for (;;) {
ul = rand();
uh = rand();
u.bits = (uint64_t)uh << 32 | ul;
printf("\r%08" PRIx64 " ", u.bits); fflush(stdout);
snprintf(buf, sizeof buf, " %.2f", u.d);
// printf("as double: %s\n\n", buf);
}
return 0;
}
-->8--
>Fix:
n/a
>Release-Note:
>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/45627 CVS commit: src/lib/libc/gdtoa
Date: Thu, 17 Nov 2011 21:38:18 -0500
Module Name: src
Committed By: christos
Date: Fri Nov 18 02:38:18 UTC 2011
Modified Files:
src/lib/libc/gdtoa: misc.c
Log Message:
PR/45627: Martin Husemann: Plug memory leak
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/gdtoa/misc.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: martin@NetBSD.org
State-Changed-When: Fri, 18 Nov 2011 13:50:41 +0000
State-Changed-Why:
verified fixed - thanks!
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.