OutOfMemory Exception
| Newsgroups | gmane.comp.windows.dotnet.nunit.user |
|---|---|
| Message-ID | <E961123C01E7E94AA29163941172913E0406B821@mail1.dundee.realtimeworlds.com> |
Hi all,
Glad to be part of the Nunit community, it's an essential development
tool as far as I'm concerned.
I have found an issue with a set of NUnit tests that we are running at
the moment that we are getting OutOfMemoryExceptions hapenning when the
tests are run repeatedly in the Nunit GUI (without closing the Nunit
window).
The code in question does Allocate and Free memory but the tests always
pass the first time they are run.
We made a smaller project that just does the memory allocation and the
same thing happens although it requires more repeated runs of the unit
tests. I searched the bugs and the previous posts on this mailing list
and I couldn't find anything so I don't know if its our code or
something about Nunit that maybe we don't understand.
The basic test we wrote to catch the issue looks like this
[Test]
public void ReAllocateAndFreeMem()
{
int x = 0;
while (x < 100)
{
m_ptr =
(IntPtr)Marshal.AllocHGlobal((Marshal.UnsafeAddrOfPinnedArrayElement(m_a
rray, 0)));
Marshal.FreeHGlobal((IntPtr)m_ptr);
x++;
}
}
And we have a setup and teardown on the fixture like this
[TestFixtureSetUp]
public void Create()
{
m_ptr =
(IntPtr)Marshal.AllocHGlobal((Marshal.UnsafeAddrOfPinnedArrayElement(m_a
rray, 0)));
}
[TestFixtureTearDown]
public void Quit()
{
Marshal.FreeHGlobal((IntPtr)m_ptr);
}
Any thoughts?
Robbie
DISCLAIMER
This message and any attachments contain privileged and confidential information intended for the use of the addressee named above. If you are not the intended recipient of this message, you are hereby notified that any use, dissemination, distribution or reproduction of this message is prohibited. Please note that we cannot guarantee that this message or any attachment is virus free or that it has not been intercepted and amended. The views of the author may not necessarily reflect those of Real Time Worlds Ltd.
____________________________________________________________________
This email has been scanned by the MessageLabs Email Security System
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Nunit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nunit-users