From owner-freebsd-hackers Sun Jan 26 17:45:53 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id RAA10779 for hackers-outgoing; Sun, 26 Jan 1997 17:45:53 -0800 (PST) Received: from alpo.whistle.com (alpo.whistle.com [207.76.204.38]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id RAA10773 for ; Sun, 26 Jan 1997 17:45:48 -0800 (PST) Received: from current1.whistle.com (current1.whistle.com [207.76.205.22]) by alpo.whistle.com (8.8.4/8.8.4) with SMTP id RAA19636 for ; Sun, 26 Jan 1997 17:42:26 -0800 (PST) Message-ID: <32EC0752.446B9B3D@whistle.com> Date: Sun, 26 Jan 1997 17:39:30 -0800 From: Julian Elischer Organization: Whistle Communications X-Mailer: Mozilla 3.0Gold (X11; I; FreeBSD 2.2-CURRENT i386) MIME-Version: 1.0 To: hackers@freebsd.org Subject: Why is this not a kernel memory leak? Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk in route.c in rtrequest() in the RTM_DELETE: clause. the clause ends with: /* * If the caller wants it, then it can have it, but it's * up to it to free the rtentry as we won't be doing it. */ if (ret_nrt) *ret_nrt = rt; else if (rt->rt_refcnt <= 0) { rt->rt_refcnt++; /* make a 1->0 transition */ rtfree(rt); } break; now in the case when (ret_nrt) is NULL, and the reference count is 1, we never call rtfree(rt). If we did, the count would go to 0 and the block would be freed, which, since we are trying to delete it would seem a reasonable thing.. why leave the eference count as 1? doesn't this defeat the whole point of reference counts? This smells of "kludge" to me.. I'm going to go hunting and hopefully I can find out what's going on enough to clean up the ref counts enough so that they become useful again.. julian