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

New Post: V8 Iterators

0
0
Hi JohnGeeB,
‚Äč
In general, if you're using a recent ClearScript version, you don't have to dispose V8 script objects. However, in some scenarios doing so may improve the application's memory efficiency.

The script engine and the CLR use separate garbage-collected heaps. When you pass an object from one to the other, the destination environment gets a proxy that by necessity prevents its target from being collected. Only when the proxy itself is collected does the target become available to its garbage collector.

Disposing the proxy simply speeds up that process by releasing the target immediately. This may be advisable if, for example, the target is known to be a very large object that is no longer in use.

Good luck!

Viewing all articles
Browse latest Browse all 2297