Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Jan 1997 17:39:30 -0800
From:      Julian Elischer <julian@whistle.com>
To:        hackers@freebsd.org
Subject:   Why is this not a kernel memory leak?
Message-ID:  <32EC0752.446B9B3D@whistle.com>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?32EC0752.446B9B3D>