Subject: Re: bin/7873: strange message from top(1)
To: None <mason@acheron.middleboro.ma.us>
From: Simon Burge <simonb@netbsd.org>
List: current-users
Date: 06/28/1999 23:15:33
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;