NetBSD Problem Report #7873

Received: (qmail 18228 invoked from network); 28 Jun 1999 13:03:01 -0000
Message-Id: <199906281302.JAA06058@acheron.middleboro.ma.us>
Date: Mon, 28 Jun 1999 09:02:59 -0400 (EDT)
From: Mason Loring Bliss <mason@acheron.middleboro.ma.us>
Reply-To: mason@acheron.middleboro.ma.us
To: gnats-bugs@gnats.netbsd.org
Subject: strange message from top(1)
X-Send-Pr-Version: 3.95

>Number:         7873
>Category:       bin
>Synopsis:       strange error message from top(1)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jun 28 06:05:01 +0000 1999
>Closed-Date:    Mon Jun 28 22:10:51 +0000 1999
>Last-Modified:  Mon Jun 28 22:12:09 +0000 1999
>Originator:     Mason Loring Bliss
>Release:        1999.06.26
>Organization:
    Mason Loring Bliss  mason@acheron.middleboro.ma.us  They also surf who
awake ? sleep : dream;  http://acheron.ne.mediaone.net  only stand on waves.
>Environment:

System: NetBSD acheron.middleboro.ma.us 1.4D NetBSD 1.4D (MLB) #0: Sat Jun 26 11:12:45 EDT 1999 root@acheron.middleboro.ma.us:/usr/src/sys/arch/i386/compile/MLB i386


>Description:

In top's status line, the following message is redrawn at each update:

top in free(): warning: page is already free.

Also, when starting top, it says:

top in free(): warning: chunk is already free.

Top seems to operate correctly other than this, and I'm not seeing a memory
leak. I'm going to today's sources and trying again.

>How-To-Repeat:

make build - There's nothing special going on here that I know of.

>Fix:

Unknown as yet.

>Release-Note:
>Audit-Trail:

From: Simon Burge <simonb@NetBSD.ORG>
To: mason@acheron.middleboro.ma.us
Cc: gnats-bugs@gnats.netbsd.org, current-users@NetBSD.ORG
Subject: Re: bin/7873: strange message from top(1) 
Date: Mon, 28 Jun 1999 23:15:33 +1000

 Mason Loring Bliss wrote:

 > >Number:         7873
 > >Category:       bin
 > >Synopsis:       strange error message from top(1)
 > 
 > >Description:
 > 
 > In top's status line, the following message is redrawn at each update:
 > 
 > top in free(): warning: page is already free.
 > 
 > Also, when starting top, it says:
 > 
 > top in free(): warning: chunk is already free.
 > 
 > Top seems to operate correctly other than this, and I'm not seeing a memory
 > leak. I'm going to today's sources and trying again.

 Can you try the following patch and let me know if it works.  It would
 also be interesting to try each NULL assignment one at a time if you
 can.  I'm not in a position to test it myself at the moment.

 Simon.
 --
 Index: display.c
 ===================================================================
 RCS file: /cvsroot/basesrc/usr.bin/top/display.c,v
 retrieving revision 1.3
 diff -p -u -r1.3 display.c
 --- display.c	1999/04/12 06:02:25	1.3
 +++ display.c	1999/06/28 13:14:30
 @@ -95,6 +95,7 @@ int display_resize()
      if (screenbuf != NULL)
      {
  	free(screenbuf);
 +	screenbuf = NULL;
      }

      /* calculate the current dimensions */
 Index: machine/m_netbsd13.c
 ===================================================================
 RCS file: /cvsroot/basesrc/usr.bin/top/machine/m_netbsd13.c,v
 retrieving revision 1.4
 diff -p -u -r1.4 m_netbsd13.c
 --- m_netbsd13.c	1999/04/12 06:02:27	1.4
 +++ m_netbsd13.c	1999/06/28 13:14:31
 @@ -405,13 +405,17 @@ get_system_info(si)
  	memory_stats[5] = dbtob(totalsize) / 1024 - memory_stats[4];
  	/*  Free here, before we malloc again in the next
  	 *  iteration of this loop.  */
 -	if (seporig)
 +	if (seporig) {
  		free(seporig);
 +		seporig = NULL;
 +	}
      } while (0);
      /*  Catch the case where we malloc'd, but then exited the
       *  loop due to nswap != rnswap.  */
 -    if (seporig)
 +    if (seporig) {
  	    free(seporig);
 +	    seporig = NULL;
 +    }

      memory_stats[6] = -1;


From: Mason Loring Bliss <mason@acheron.middleboro.ma.us>
To: "Martin J. Laubach" <mjl@emsi.priv.at>
Cc: gnats-bugs@netbsd.org
Subject: Re: bin/7873: strange message from top(1)
Date: Mon, 28 Jun 1999 11:10:38 -0400

 On Mon, Jun 28, 1999 at 04:11:11PM +0200, Martin J. Laubach wrote:

 > | In top's status line, the following message is redrawn at each update:
 > | 
 > | make build - There's nothing special going on here that I know of.
 > 
 >   I do! MALLOC_NEW in /etc/mk.conf.

 Hm. I didn't have MALLOC_NEW defined... I'll rebuild with after I try the
 patches I received from Simon. (Rebuilding top alone with that in mk.conf
 didn't show me any different behaviour, but I'm guessing I need to rebuild
 libraries as well...?)

 -- 
     Mason Loring Bliss  mason@acheron.middleboro.ma.us  They also surf who
 awake ? sleep : dream;  http://acheron.ne.mediaone.net  only stand on waves.
State-Changed-From-To: open->closed 
State-Changed-By: tron 
State-Changed-When: Mon Jun 28 15:10:51 PDT 1999 
State-Changed-Why:  
A memory block got freed twice in the NetBSD dependent part of "top". 

From: Michael Graff <explorer@flame.org>
To: mason@acheron.middleboro.ma.us
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: bin/7873: strange message from top(1)
Date: 01 Jul 1999 11:45:39 -0700

 I got this behavior when I switched to the FreeBSD-derived malloc().
 I think top is doing something bad, but I haven't taken the time to
 track it down yet, or care to since it still "works."

 --Michael
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.