JavaScript-1.5 Reference

JS_GC Function

Summary

Performs garbage collection in the JS memory pool.

Syntax

void JS_GC(JSContext *cx);

Description

JS_GC performs garbage collection, if necessary, of JS objects, doubles, and strings that are no longer needed by a script executing in a specified JSContext, cx. Garbage collection frees space in the memory pool so that it can be reused by the JS engine.

When you use JS_malloc and JS_realloc to allocate memory for executable script contexts, these routines automatically invoke the garbage collection routine.

When your scripts create many objects, you may want to call JS_GC directly in your code, particularly when request ends or a script terminates. To run garbage collection only when a certain amount of memory has been allocated, you can call JS_MaybeGC instead of JS_GC.

See Also

Groups [ Function ]
Documents [ LXR ID Search ]
Entries [ JS_MaybeGC | JS_malloc | JS_realloc ]

This page was generated by APIDOC