Skip to content

Instantly share code, notes, and snippets.

@MeinLiX
Created October 12, 2021 15:32
Show Gist options
  • Save MeinLiX/b3b515650e811dc5d4fa80b937a83be0 to your computer and use it in GitHub Desktop.
Save MeinLiX/b3b515650e811dc5d4fa80b937a83be0 to your computer and use it in GitHub Desktop.
RAM loader .net 6
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