[ofw] [PATCH] winverbs: delete critical sections when no longerneeded

Tzachi Dar tzachid at mellanox.co.il
Mon Jan 18 08:52:50 PST 2010


Hi Sean,

I have synced to the latest trunk of the community and I must say that I
can still see the leak. Smaller than before but it still seems to be
there.

I'm running: ndconn.exe c 11.4.12.128 1001 t1

And the leak is very clear.


Thanks
Tzachi 

> -----Original Message-----
> From: ofw-bounces at lists.openfabrics.org 
> [mailto:ofw-bounces at lists.openfabrics.org] On Behalf Of Sean Hefty
> Sent: Friday, January 15, 2010 2:49 AM
> To: ofw_list
> Subject: [ofw] [PATCH] winverbs: delete critical sections 
> when no longerneeded
> 
> To avoid leaking memory, we need to call 
> DeleteCriticalSection for all critical sections once they are 
> no longer needed.
> 
> Signed-off-by: Sean Hefty <sean.hefty at intel.com>
> ---
> This should go in WOF2-2.  I checked all critical sections 
> initialized using InitializeCriticalSection.
> 
>  trunk/core/winmad/user/wm_provider.cpp  |    2 ++
>  trunk/core/winverbs/user/wv_base.cpp    |    1 +
>  trunk/ulp/libibumad/src/umad.cpp        |    1 +
>  trunk/ulp/netdirect/user/nd_adapter.cpp |    1 +
>  4 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/trunk/core/winmad/user/wm_provider.cpp 
> b/trunk/core/winmad/user/wm_provider.cpp
> index 96c20da..b0adc07 100644
> --- a/trunk/core/winmad/user/wm_provider.cpp
> +++ b/trunk/core/winmad/user/wm_provider.cpp
> @@ -64,6 +64,8 @@ CWMProvider::~CWMProvider()
>  		CloseHandle(m_OverlapWrite.hEvent);
>  	}
>  	CloseHandle(m_hFile);
> +	DeleteCriticalSection(&m_CritSecRead);
> +	DeleteCriticalSection(&m_CritSecWrite);
>  	InterlockedDecrement(&WmRef);
>  }
>  
> diff --git a/trunk/core/winverbs/user/wv_base.cpp 
> b/trunk/core/winverbs/user/wv_base.cpp
> index 52e9b6e..5ed4e9f 100644
> --- a/trunk/core/winverbs/user/wv_base.cpp
> +++ b/trunk/core/winverbs/user/wv_base.cpp
> @@ -47,6 +47,7 @@ CWVBase::~CWVBase()
>  	if (m_Overlap.hEvent != NULL) {
>  		CloseHandle(m_Overlap.hEvent);
>  	}
> +	DeleteCriticalSection(&m_CritSec);
>  }
>  
>  STDMETHODIMP CWVBase::
> diff --git a/trunk/ulp/libibumad/src/umad.cpp 
> b/trunk/ulp/libibumad/src/umad.cpp
> index 6204be0..62473e3 100644
> --- a/trunk/ulp/libibumad/src/umad.cpp
> +++ b/trunk/ulp/libibumad/src/umad.cpp
> @@ -68,6 +68,7 @@ int umad_init(void)
>  __declspec(dllexport)
>  int umad_done(void)
>  {
> +	DeleteCriticalSection(&crit_sec);
>  	return 0;
>  }
>  
> diff --git a/trunk/ulp/netdirect/user/nd_adapter.cpp 
> b/trunk/ulp/netdirect/user/nd_adapter.cpp
> index 107a44e..805f77b 100644
> --- a/trunk/ulp/netdirect/user/nd_adapter.cpp
> +++ b/trunk/ulp/netdirect/user/nd_adapter.cpp
> @@ -96,6 +96,7 @@ CNDAdapter::~CNDAdapter(void)
>  		m_pWvProvider->Release();
>  	}
>  	m_pProvider->Release();
> +	DeleteCriticalSection(&m_Lock);
>  }
>  
>  STDMETHODIMP CNDAdapter::
> 
> 
> _______________________________________________
> ofw mailing list
> ofw at lists.openfabrics.org
> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw
> 



More information about the ofw mailing list