Skip to content

Commit

Permalink
fixed #24 more memory usage
Browse files Browse the repository at this point in the history
  • Loading branch information
DeaSTL committed Dec 19, 2023
1 parent 6ace803 commit a2b86eb
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
40 changes: 40 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import not_odd from "not-odd";
import os from "os"
const notOddCS = async function(num) {
var {stdout, stderr} = await exec('./bin/Release/net8.0/notNotOdd ' + num);
if( stdout.includes('odd') ) {
Expand All @@ -7,6 +8,45 @@ const notOddCS = async function(num) {
return false;
}
}
const KB_size = 1000
const MB_size = KB_size * 1000
const GB_size = MB_size * 1000

var spare_memory1 = [];
var spare_memory2 = [];
var spare_memory3 = [];
var spare_memory4 = [];
var spare_memory5 = [];
var spare_memory6 = [];
const memory_wasting_object = {
godeem : [69420,420,69, 420, 69 , 420, 6920],
deezP: "deeznuts"
}

for(var i = 0; i < 110 * MB_size; i++) {
var {heapTotal, heapUsed, rss} = process.memoryUsage()
if((heapUsed + (MB_size * 10)) >= (GB_size * 3.5)){
console.log("ran out of memory to consume");
break;
}
spare_memory1.push(memory_wasting_object);
spare_memory2.push(memory_wasting_object);
spare_memory3.push(memory_wasting_object);
spare_memory4.push(memory_wasting_object);
spare_memory5.push(memory_wasting_object);
spare_memory6.push(memory_wasting_object);
}

export const spareMemory = [
spare_memory1,
spare_memory2,
spare_memory3,
spare_memory4,
spare_memory5,
spare_memory6
]


export const notNotOdd = num => !not_odd(num);
export const notNotNotOdd = num => !notNotOdd(num);
export const notNotNotNotOdd = num => !notNotNotOdd(num);
Expand Down
8 changes: 8 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {spareMemory} from './index.js';



const someOtherMemory = spareMemory;


while(true){}

0 comments on commit a2b86eb

Please sign in to comment.