On Sun, 20 Feb 2005 23:24:59 -0500, Parag Warudkar
> On Sunday 20 February 2005 08:22 pm, Giridhar Pemmasani wrote:
> > NdisAllocateBuffer is called by the driver - ndiswrapper has to call
> > kmalloc to complete this call, so it certainly is not ndiswrapper
> > issue in this case. Whether it is Broadcom driver or not is any body's
> > guess. I heard that sometime during 2.6.10 to 2.6.11-rc4 memory issues
> > surfaced (I saw in lkml same problem reported without ndiswrapper), so
> > it is possible something is triggering this behavior. Try older than
> > 2.6.10 kernel or 2.6.11-rc4-bkX.
> Ok, here is the scoop -
> For the following reasons, the kernel is not at fault -
> 1) Kernel runs fine without ndiswrapper
> 2) I did track kmalloc usage and its callers - NdisAllocateBuffer is the
> culprit which is called a zillion times without a single corresponding
> NdisFreeBuffer which means a zillion kmallocs with no kfrees - leak.
> For the following reasons NdisWrapper is the culprit -
> 1) Driver starts calling NdisAllocateBuffer the moment it is loaded and keeps
> calling it for ever.
> 2) Driver calls NdisAllocateBuffer only handful of times for distinct Virtual
> Addresses (Parameter #4 - void* virt). IOW, 98% calls of NdisAllocateBuffer
> are for a previously asked Virt Addr. MSDN documentation is unclear but it
> would seem this is perfectly alright.
> 3) We do a kmalloc for every NdisAllocateBuffer. -- This is the problem. We
> should track if the VA was previously given a buffer. If so we should free
> that buffer and return a new mapping.
> Attached experimental patch works and doesn't leak. I have tested it by
> downloading the linux kernel @400KB/s and it seems fine. I don't suggest
> applying it to main tree yet - I am planning on a better solution avoiding
> those zillion kmallocs and kfrees.
> Any one having memory leak problem with the 64Bit Broadcom driver, please test
> keeping in mind that it is experimental.
Thanks a ton Parag. Great work tracking down the leak. I guess I'll
have to retract my bugzilla :). I'll try your patch as soon as I get
a chance to. By the way, which version did you apply it to? That is,
which version did you make the changes to? I have only been able to
get version 1.0 to work for me, as I said before. Once this leak is
fixed for good, I should be able to use my wireless.
PS: You sent a message after this that seems blank to me. Looking at
the source, it seems to have binary content, though it's MIME type is
plain text. It's a Fwd:, so perhaps did it attach the email? I can't
figure it out.