Created
October 12, 2021 15:32
-
-
Save MeinLiX/b3b515650e811dc5d4fa80b937a83be0 to your computer and use it in GitHub Desktop.
RAM loader .net 6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Threading; | |
List<byte[]> buffer = new List<byte[]>(); | |
List<string> Args = new(args); | |
bool showMessage = Args.Contains("-msg"); | |
bool mbArg = false; | |
int maxMB = 0; | |
if (Args.Contains("-mb") && Args.Count >= 2) | |
{ | |
try | |
{ | |
maxMB = Convert.ToInt32(Args[Args.IndexOf("-mb") + 1]); | |
mbArg = true; | |
} | |
catch { mbArg = false; } | |
} | |
while (true) | |
{ | |
var buf = new byte[1048576]; | |
for (int j = 0; j < buf.Length; j++) | |
buf[j] = 1; | |
buffer.Add(buf); | |
if (showMessage) Console.WriteLine("Mb loaded : " + buffer.Count); | |
if (mbArg && maxMB <= buffer.Count) break; | |
} | |
Console.WriteLine("Press Ctrl+C to exit..."); | |
while (true) { Thread.Sleep(60 * 60 * 1000); } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment