Skip to content

Instantly share code, notes, and snippets.

@ivanbuzyka
Created April 10, 2019 10:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivanbuzyka/791c029fbba47c2c27a337b11d3c11e6 to your computer and use it in GitHub Desktop.
Save ivanbuzyka/791c029fbba47c2c27a337b11d3c11e6 to your computer and use it in GitHub Desktop.
Sitecore sample view layout that contains memory leak code
@using System.Threading
@using Sitecore.Mvc
@using Sitecore.Mvc.Analytics.Extensions
@using Sitecore.Mvc.Presentation
@model RenderingModel
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<title>@Html.Sitecore().Field("title", new { DisableWebEdit = true })</title>
</head>
<body>
<h1>@Html.Sitecore().Field("title")</h1>
<div>
@Html.Sitecore().Placeholder("main")
@{
var limit = 9400;
for (int i= 0; i < 1000; i++)
{
new Thread(() =>
{
var rnd = new Random();
var list = new List<byte[]>();
for (int j = 0; j < 1000; j++)
{
byte[] b = new byte[limit];
b[rnd.Next(0, b.Length)] = byte.MaxValue;
list.Add(b);
Thread.Sleep(10);
}
}).Start();
}
}
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment