memleak.aspx

来自「Professional ASP.NET source code」· ASPX 代码 · 共 37 行

ASPX
37
字号
<%@ Import Namespace="System.Diagnostics" %>
<%@ Import Namespace="System.Text" %>

<script language="C#" runat=server>

   void Page_Load(Object Sender, EventArgs E) 
   {
      if (Application["MemLeak"] == null)
        Application["MemLeak"] = new StringBuilder();

      int i;
      StringBuilder buffer = (StringBuilder)Application["MemLeak"];

      for (i=1; i<=100000; i++)
         buffer.Append("Adding more and more and more...");

      Process ProcessInfo = Process.GetCurrentProcess();
      
      ProcessId.Text = ProcessInfo.Id.ToString();
      VirtualMemSize.Text = ProcessInfo.VirtualMemorySize.ToString();
   
   }

</script>

<html>
   <body>

      <h1> Memory Leak Example.... </h1>

      <hr>

      <h2>Process ID of ASP+: <asp:label id="ProcessId" forecolor=red runat=server/> </h2>
      <h2>Virtual Memory Size of ASP+: <asp:label id="VirtualMemSize" forecolor=red runat=server/> </h2>

   </body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?