Skip to content

Commit eddc62b

Browse files
committed
fix memory
1 parent 4907777 commit eddc62b

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

js/brainchop/mainMeshNetFunctions.js

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4141,8 +4141,7 @@ class SequentialConvLayer {
41414141
// Important to avoid "undefined" class var members inside the timer.
41424142
// "this" has another meaning inside the timer.
41434143

4144-
// *** WARNING!!! if you uncomment this line the memory leak will break webGL and may reboot your machine
4145-
//document.getElementById("progressBarChild").parentElement.style.visibility = "visible";
4144+
document.getElementById("progressBarChild").parentElement.style.visibility = "visible";
41464145

41474146
return new Promise((resolve, reject) => {
41484147

@@ -4184,32 +4183,27 @@ class SequentialConvLayer {
41844183
});
41854184

41864185
// -- await showMemStatus(chIdx, self.outChannels);
4187-
// Log memory usage
4188-
const memoryInfo = tf.memory();
4189-
console.log(`Iteration ${chIdx}:`);
4190-
console.log(`Number of Tensors: ${memoryInfo.numTensors}`);
4191-
console.log(`Number of Data Buffers: ${memoryInfo.numDataBuffers}`);
4192-
console.log(`Bytes In Use: ${memoryInfo.numBytes}`);
4193-
console.log(`Megabytes In Use: ${(memoryInfo.numBytes / 1048576).toFixed(3)} MB`);
4194-
console.log(`Unreliable: ${memoryInfo.unreliable}`);
4186+
41954187
// Assign the new values to outC and outB
41964188
outC = result[0];
41974189
outB = result[1];
41984190

41994191
if(chIdx == (self.outChannels -1)) {
42004192

42014193
window.clearInterval( seqTimer );
4202-
// *** WARNING!!! if you uncomment this line the memory leak will break webGL and may reboot your machine
4203-
// document.getElementById("progressBarChild").style.width = 0 + "%";
4194+
document.getElementById("progressBarChild").style.width = 0 + "%";
42044195
tf.dispose(outB);
42054196
const endTime = performance.now();
42064197
const executionTime = endTime - startTime;
42074198
console.log(`Execution time for output layer: ${executionTime} milliseconds`);
42084199
resolve(outC);
4200+
} else {
4201+
4202+
chIdx++;
4203+
document.getElementById("progressBarChild").style.width = (chIdx + 1)*100/self.outChannels + "%";
42094204
}
4210-
chIdx++;
4211-
// *** WARNING!!! if you uncomment this line the memory leak will break webGL and may reboot your machine
4212-
//document.getElementById("progressBarChild").style.width = (chIdx + 1)*100/self.outChannels + "%";
4205+
4206+
42134207
}, 10);
42144208
});
42154209

0 commit comments

Comments
 (0)