📄 memleak.aspx
字号:
<%@ Import Namespace="System.Diagnostics" %>
<%@ Import Namespace="System.Text" %>
<script Language="C#" runat=server>
void Page_Load(Object Sender, EventArgs E)
{
int i;
StringBuilder garbage = new StringBuilder();
if (Application["garbage"] == null)
{
for (int c=1; c<=1000; c++)
garbage = garbage.Append("xxxxxxxxxx");
Application["garbage"] = garbage;
}
else
garbage = (StringBuilder)Application["garbage"];
for (i=1; i<=500; i++)
{
// Make sure we create a unique entry
Application[i.ToString() + DateTime.Now.ToString("r")] = (garbage.ToString() + DateTime.Now.ToString("r"));
}
ProcessInfo p;
p = ProcessModelInfo.GetCurrentProcessInfo();
ProcessID.Text = p.ProcessID.ToString();
}
</script>
<html>
<body>
<h2>The Process ID serving this request is: <asp:label id="ProcessID" forecolor=red runat=server/> </h2>
<h2>There are <%=Application.Count.ToString()%> items in Application state memory.</h2>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -