33 lines · 1.1 KB · JavaScript
RawDownload
////  prefetchTest.js//  scripts/developer/tests/scriptableResource ////  Created by Zach Pomerantz on 4/27/16.//  Copyright 2016 High Fidelity, Inc.////  Preloads textures and unloads them.////  Distributed under the Apache License, Version 2.0.//  See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html// Script.include([    '../../../developer/utilities/cache/cacheStats.js',    'lib.js',], function() {    prefetch(function(frames) {        // Delete each texture, so the next garbage collection cycle will release them.         // Setting frames = null breaks the reference,        // but will not delete frames from the calling scope.        // Instead, we must mutate it in-place to free its elements for GC        // (assuming the elements are not held elsewhere).        while (frames.length) { frames.pop(); }         // Alternatively, forcibly release each texture without relying on GC.        // frames.forEach(function(texture) { texture.release(); });         Script.requestGarbageCollection();    });}); 

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t