Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OutOfMemoryException #41

Closed
megerlms opened this issue Nov 28, 2018 · 5 comments
Closed

OutOfMemoryException #41

megerlms opened this issue Nov 28, 2018 · 5 comments

Comments

@megerlms
Copy link

megerlms commented Nov 28, 2018

I'm using altcover to cover my unit tests written with xUnit.
Sometimes it happens that I get an OutOfMemoryException when the coverage tool is generating the result file.
The PC hat 8GB RAM that should be sufficient.
The exception looks like this:
.....coverage.xml.0.acv (8.628.739b)

Unhandled Exception:
System.OutOfMemoryException: Insufficient memory to continue the execution of the program.
at (wrapper alloc) System.Object.AllocVector(intptr,intptr)
at System.Collections.Generic.List1[T].set_Capacity (System.Int32 value) <0x7fdffebcd190 + 0x00053> in <0f8aeac9d63d4b8aa575761bb4e65b79>:0 at System.Collections.Generic.List1[T].AddWithResize (T item) <0x7fdffebcd560 + 0x00063> in <0f8aeac9d63d4b8aa575761bb4e65b79>:0
at System.Collections.Generic.List1[T].Add (T item) <0x7fdffebcd510 + 0x00048> in <0f8aeac9d63d4b8aa575761bb4e65b79>:0 at AltCover.Runner.sink@432 (System.Collections.Generic.ICollection1[T] hits, System.IO.BinaryReader formatter, Microsoft.FSharp.Core.Unit unitVar0) [0x000d5] in :0
at AltCover.Runner+CollectResults@425.Invoke (System.String f) [0x00076] in :0
at Microsoft.FSharp.Collections.SeqModule.Iterate[T] (Microsoft.FSharp.Core.FSharpFunc2[T,TResult] action, System.Collections.Generic.IEnumerable1[T] source) [0x0002c] in <5b5a6cc1904cf4daa7450383c16c5a5b>:0
at AltCover.Runner.CollectResults (System.Collections.Generic.ICollection1[T] hits, System.String report) [0x00044] in <ff776df29b8d4500bb9107f1fcd3295d>:0 at AltCover.Runner.MonitorBase (System.Collections.Generic.ICollection1[T] hits, System.String report, Microsoft.FSharp.Core.FSharpFunc2[T,TResult] payload, Microsoft.FSharp.Collections.FSharpList1[T] args) [0x0001b] in :0
at AltCover.Runner+GetMonitor@748.Invoke (System.Collections.Generic.ICollection1[T] hits, System.String report, Microsoft.FSharp.Core.FSharpFunc2[T,TResult] payload, Microsoft.FSharp.Collections.FSharpList1[T] args) [0x00000] in <ff776df29b8d4500bb9107f1fcd3295d>:0 at AltCover.Runner+value@776.Invoke (Microsoft.FSharp.Core.Unit unitVar0) [0x00058] in <ff776df29b8d4500bb9107f1fcd3295d>:0 at AltCover.CommandLine.doPathOperation[a] (Microsoft.FSharp.Core.FSharpFunc2[T,TResult] f, a defaultValue, System.Boolean store) [0x000a1] in :0
at AltCover.Runner.DoCoverage[a] (System.String[] arguments, a options1) [0x00051] in :0
at AltCover.Main.Main (System.String[] arguments) [0x00035] in :0
at AltCover.Main+EffectiveMain@469.Invoke (System.String[] arguments) [0x00000] in :0
[ERROR] FATAL UNHANDLED EXCEPTION: System.OutOfMemoryException: Insufficient memory to continue the execution of the program.
at (wrapper alloc) System.Object.AllocVector(intptr,intptr)
at System.Collections.Generic.List1[T].set_Capacity (System.Int32 value) <0x7fdffebcd190 + 0x00053> in <0f8aeac9d63d4b8aa575761bb4e65b79>:0 at System.Collections.Generic.List1[T].AddWithResize (T item) <0x7fdffebcd560 + 0x00063> in <0f8aeac9d63d4b8aa575761bb4e65b79>:0
at System.Collections.Generic.List1[T].Add (T item) <0x7fdffebcd510 + 0x00048> in <0f8aeac9d63d4b8aa575761bb4e65b79>:0 at AltCover.Runner.sink@432 (System.Collections.Generic.ICollection1[T] hits, System.IO.BinaryReader formatter, Microsoft.FSharp.Core.Unit unitVar0) [0x000d5] in :0
at AltCover.Runner+CollectResults@425.Invoke (System.String f) [0x00076] in :0
at Microsoft.FSharp.Collections.SeqModule.Iterate[T] (Microsoft.FSharp.Core.FSharpFunc2[T,TResult] action, System.Collections.Generic.IEnumerable1[T] source) [0x0002c] in <5b5a6cc1904cf4daa7450383c16c5a5b>:0
at AltCover.Runner.CollectResults (System.Collections.Generic.ICollection1[T] hits, System.String report) [0x00044] in <ff776df29b8d4500bb9107f1fcd3295d>:0 at AltCover.Runner.MonitorBase (System.Collections.Generic.ICollection1[T] hits, System.String report, Microsoft.FSharp.Core.FSharpFunc2[T,TResult] payload, Microsoft.FSharp.Collections.FSharpList1[T] args) [0x0001b] in :0
at AltCover.Runner+GetMonitor@748.Invoke (System.Collections.Generic.ICollection1[T] hits, System.String report, Microsoft.FSharp.Core.FSharpFunc2[T,TResult] payload, Microsoft.FSharp.Collections.FSharpList1[T] args) [0x00000] in <ff776df29b8d4500bb9107f1fcd3295d>:0 at AltCover.Runner+value@776.Invoke (Microsoft.FSharp.Core.Unit unitVar0) [0x00058] in <ff776df29b8d4500bb9107f1fcd3295d>:0 at AltCover.CommandLine.doPathOperation[a] (Microsoft.FSharp.Core.FSharpFunc2[T,TResult] f, a defaultValue, System.Boolean store) [0x000a1] in :0
at AltCover.Runner.DoCoverage[a] (System.String[] arguments, a options1) [0x00051] in :0
at AltCover.Main.Main (System.String[] arguments) [0x00035] in :0
at AltCover.Main+EffectiveMain@469.Invoke (System.String[] arguments) [0x00000] in :0

Mono version used is:
mono --version
Mono JIT compiler version 5.16.0.220 (tarball Mon Nov 26 17:17:59 UTC 2018)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
Interpreter: yes
LLVM: yes(3.6.0svn-mono-/)
GC: sgen (concurrent by default)

OS is: Ubuntu 18.04

@SteveGilham
Copy link
Owner

The compression used in the visit file format means there can be a lot of visits per output byte if there are repetitive patterns.

As a work-around, if you are interested only in "did I visit this place?", rather than "how many times did I do so?", the --single command line option can significantly reduce the amount of data being processed.

@megerlms
Copy link
Author

megerlms commented Nov 28, 2018

Indeed, I tried this option already. Unfortunately I could not mention any difference.
The calls I do use are....

...for instrumentation:
$ALTCOV --single -i $WORKING_DIR -o $WORKING_DIR/instr/ -s xunit* -s ${TEST_ASM:0:-4} -s AWS*

...for running:
$ALTCOV Runner -x mono -c coverage/${TEST_ASM}.cort.xml -r=${WORKING_DIR}/instr/ -- $XUNIT ${WORKING_DIR}/instr/${TEST_ASM} -xml ./testresults/${TEST_ASM}.tests.xml

Note:
$ALTCOVER points to the altcover executable
$XUNIT points to the xUnit executable

@SteveGilham
Copy link
Owner

I'll have to do some more investigation to see if I can find why --single seems to have no effect for you. In the mean time, pre-release build 656 contains a change that should mitigate the memory use for the intermediate processing, where the stack trace is indicating.

Could you give that a try?

@SteveGilham SteveGilham added the ready to close Believed addressed, waiting to hear to the contrary label Dec 2, 2018
@megerlms
Copy link
Author

megerlms commented Dec 3, 2018

I was some days occupied by other stuff, I will give it a try.

@megerlms
Copy link
Author

megerlms commented Dec 3, 2018

I tried the new release 659 and the exception didn't appear. Also the --single option seems to work.
Thanks for the quick fix!

@SteveGilham SteveGilham removed the ready to close Believed addressed, waiting to hear to the contrary label Dec 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Development

No branches or pull requests

2 participants