cvs commit: src/sys/kern kern_linker.c

Nate Lawson nate at root.org
Fri Apr 9 10:44:12 PDT 2004


On Fri, 9 Apr 2004, Peter Edwards wrote:
> Nate Lawson wrote:
> >On Fri, 9 Apr 2004, Peter Edwards wrote:
> >>peadar      2004/04/09 08:27:38 PDT
> >>
> >>  FreeBSD src repository
> >>
> >>  Modified files:
> >>    sys/kern             kern_linker.c
> >>  Log:
> >>  Plug minor memory leak of module_t structures when unloading a file
> >>  from the kernel.
> >>
> >>  Reviewed By: Doug Rabson (dfr@)
> >>
> >>  Revision  Changes    Path
> >>  1.110     +3 -1      src/sys/kern/kern_linker.c
> >
> >Excellent!  In stress testing some attach/detach routines with
> >load/unload, I noticed memory allocation slowly increasing but couldn't
> >find a problem with my driver.  Are there any other observable leaks?
>
> As far as I can tell, that was the only leak. I was updating NFS
> client/server to allow safe loads/unloads, and with the patch, 2 minutes
> running this:
>
> > while true
> > do
> >     kldload nfsclient
> >     kldunload nfsclient
> > done
>
> made no noticable difference to the wired memory reported in top, or any
> of the "InUse" counts from vmstat -m.

Great.  You might also want to artificially introduce an error in the
attach routine at the end to make sure it really cleans up resources
correctly.  I basically did an artificial "error = ENXIO; goto out;" after
a successful attach to test the resource cleanup.  Then load/unload like
above.  I wasn't sure if it was a leak in resource handling or the driver.
Perhaps this bug is the only one but if you have time to check, that would
be nice.

-Nate


More information about the cvs-src mailing list