Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
66
assets/webapps/membuster.gaiamobile.org/membuster.js
Normal file
66
assets/webapps/membuster.gaiamobile.org/membuster.js
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
var arr = [];
|
||||
function bustSysmem() {
|
||||
setInterval(allocChunk, 1000);
|
||||
}
|
||||
|
||||
var chunks = [ ]; // root the chunks
|
||||
var nextChunkMB = 32;
|
||||
var totalAllocMB = 0;
|
||||
function allocChunk() {
|
||||
var allocSizeMB = nextChunkMB * 1024 * 1024;
|
||||
var array = new ArrayBuffer(allocSizeMB);
|
||||
|
||||
// Ensure all pages are committed.
|
||||
var view = new Int32Array(array);
|
||||
for (var j = 0; j < view.length; j += 1024) {
|
||||
view[j] = 42;
|
||||
}
|
||||
|
||||
totalAllocMB += nextChunkMB;
|
||||
log("Allocated "+ nextChunkMB +"MB; total so far is "+ totalAllocMB+ "MB");
|
||||
|
||||
if (nextChunkMB > 1) {
|
||||
nextChunkMB >>= 1
|
||||
}
|
||||
|
||||
chunks.push(array);
|
||||
}
|
||||
|
||||
function bustGfxmem() {
|
||||
setInterval(allocCanvas, 1000);
|
||||
}
|
||||
|
||||
var totalGfxMB = 0;
|
||||
function allocCanvas() {
|
||||
var c = document.createElement("canvas");
|
||||
// We want to allocate 1MB of gfx mem. Canvases are double buffered
|
||||
// and default to RGBA. So we create one with 128K pixels.
|
||||
var w = 128, h = 1024;
|
||||
c.width = w;
|
||||
c.height = h;
|
||||
|
||||
var ctx = c.getContext('2d');
|
||||
ctx.clearRect(0, 0, w, h);
|
||||
ctx.fillStyle = 'rgba(0, 0, 255, 0.1)';
|
||||
ctx.rect(0, 0, w, h);
|
||||
ctx.fill();
|
||||
|
||||
++totalGfxMB;
|
||||
log("Allocated 1MB gfx memory; total so far is ~"+ totalGfxMB +"MB");
|
||||
|
||||
document.getElementById("canvases").appendChild(c);
|
||||
}
|
||||
|
||||
var logElt;
|
||||
function log(msg) {
|
||||
if (!logElt) {
|
||||
logElt = document.getElementById("log");
|
||||
}
|
||||
logElt.textContent = msg;
|
||||
console.log(msg);
|
||||
}
|
||||
|
||||
window.onload = function() {
|
||||
document.getElementById("sys").onclick = function() { bustSysmem(); };
|
||||
document.getElementById("gfx").onclick = function() { bustGfxmem(); };
|
||||
};
|
||||
Loading…
Reference in a new issue