chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
Welcome to Typemock Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes
Hello,

I'm using the typemock library v7.4.2 for .NET and I want to mock a large interface (~630 methods) for unit tests.
After 10 seconds processing the following line...
Dim mJob As IJobInterface = Isolator.VisualBasic.IsolateVB.FakeInstance(Of IJobInterface)()

...an OutOfMemoryException occurs while the working set size reach 1.6 GB.

Am I doing something wrong or is there another way to mock that object. I need this mock for every unit test so good performance is also required.
IJobInterface is an Interface of a C++ COM class if it's important for you.

Cheers
asked by helix (720 points)

7 Answers

0 votes
Hi,

I would like to reproduce this issue on my machine but I need ccpapi.dll for this which I can't find.
Can you send me this dll so I can look into it?
answered by alex (17k points)
0 votes
Hello Alex,

I don't know what you mean with "ccpapi.dll" but here is the library including IJobInterface:
ftp://e3-delivery:vK5Bj7sPSLCe9yj@194.3 ... nterop.dll

Add it as a reference and import the e3 namespace then you can use the line above.
There are a lot more interfaces inside just ignore them.

Best regards
answered by helix (720 points)
0 votes
Hi,

Thank you for the dll, but unfortunately this issue doesn't reproduce even for the following code:
For i As Integer = 0 To 1000
     Dim mJob As IJobInterface = Isolator.VisualBasic.IsolateVB.FakeInstance(Of IJobInterface)()
Next


1) Run this line in a separate test and let me know if it reproduces.
2) Run Isolator with log and sent it to me.
In order to turn logs on go to Typemock menu in VS -> Options -> Visual Studio -> ..Mocking Unit Tests Run..

Looking forward to your reply.
answered by alex (17k points)
0 votes
Hello,

my test contains only one line. It's reproducable without the loop:

<TestMethod()> Public Sub TestWithTypeMock()
        Dim mJob As IJobInterface = Isolator.VisualBasic.IsolateVB.FakeInstance(Of IJobInterface)()
End Sub

Here is the log output: ftp://e3-delivery:vK5Bj7sPSLCe9yj@194.3 ... d/Logs.zip

Regards
answered by helix (720 points)
0 votes
Hi,

We managed to reproduce the problem here. It has to do with the way Isolator fakes interfaces, and the large interface is the source of the issue.
There's a workaround though: Mocking the concrete object that implements the interface, rather than the interface itself.

Can you try it and see if that works?

Gil Zilberfeld
Product Manager
answered by gilz (14.5k points)
0 votes
Hello Gil,

the performance issue is solved with that workaround - thank you!
Will there be a fix for this in future releases since it's just a workaround?

Best regards
answered by helix (720 points)
0 votes
Hi,

We didn't fix this issue for the upcoming release.
However, it is in our backlog and will be fixed in the future.
answered by alex (17k points)
...