Closed logicaloud closed 2 years ago
Hi @logicaloud,
Thanks for reporting this!
There appears to be a leak within the .NET runtime's COM infrastructure. ClearScript triggers it when the host passes certain kinds of objects to the script engine, including PropertyBag
instances and other so-called "expando" objects.
The good news is that engaging the COM infrastructure is completely unnecessary when dealing with V8. That gives us an easy way to work around the bug.
Our next release, hopefully out later this week, will include the workaround.
Thanks again!
That's great, thank you. I'll check it out as soon as it is available.
Version 7.3.3 added a workaround for the leak.
The following code shows a linear increase in Private Bytes, Working Set and Working Set Peak in Performance Monitor running on Windows 10. Handle Count is stable. Memory usage grows to a GB within an hour or so.
The code creates the runtime once with the engine being created and disposed repeatedly. Garbage collection is forced every 15 seconds. It does not seem to matter whether the property bags are created once outside the loop or new for every engine. Compiling vs not compiling the script makes no difference.
Tested with ClearScript v7.3.2 and NET 6 on 64-bit Windows 10.
Is there anything that I should do differently?