Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: I get memory leaks without running CollectGarbage

$
0
0
Hi I have a script that is simply:
function foo(items) {
    items.toSomething(); // toSomething is a .NET function that does something to the list and returns a new one.
}

loop { // this loop runs many times
     var items = new List<int>(); // This list grows over time.
    _engine.Script.foo(items);
}
I find that if I do not collect garbage eventually I end up with a memory leak, what is it holding onto I assume the collection passed into the method? running garbage collection impacts my performance, is there something else I can do?



Thanks

Viewing all articles
Browse latest Browse all 2297

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>