clearGarbageCollection
清理数组中存储的语音对象的垃圾回收
清理GC
let artyom = new Artyom();
// The clear command needs to be executed
// always in the last artyom.say function
artyom.say("Hello , this is a long text 1 .");
artyom.say("Hello , this is a long text 2.");
artyom.say("Hello , this is a long text 3.");
artyom.say("Hello , this is a long text 4.");
artyom.say("Hello , this is a long text 5.");
artyom.say("Hello , this is a long text 6.");
artyom.say("Hello , this is a long text 7.");
artyom.say("Hello , this is a long text. Now i'll clean the garbage collection.",{
onEnd: function(){
var totalObjectsInCollection = artyom.getGarbageCollection().length;
// Clear now that there are no more text to say.
artyom.clearGarbageCollection();
alert("The garbage collection has been cleaned. "+totalObjectsInCollection+" Items found. Now there are " + artyom.getGarbageCollection().length);
}
});为什么需要清理gc
Last updated
Was this helpful?