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

Tzachi Dar tzachid at mellanox.co.il
Fri Jan 15 06:07:15 PST 2010


Can you try runinng the nd connect test for 10 minutes to see if the
problem is realy solved?

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