# 一份ASP記憶體的釋放的實驗報告

<script language=vbscript runat=server>
Dim temp1,temp2

'temp1 = space(1024*1024*50) '50MB

for i = 0 to 5000000 ' 延遲
next

'temp1="" '開關變數

'temp2 = space(1024*1024*50) '50MB

for i = 0 to 5000000 ' 延遲
next

Response.write "<meta http-equiv='refresh' content='4;url=http://localhost/memory_test.ASP'>"
</script>

CPU的波形變化是由頁面自動重新整理引起的,不必在意!我們要觀察的只是記憶體線的變化.這是原始狀態,記憶體線保持水平無變化.

'temp1 = space(1024*1024*50) '50MB

temp1 = space(1024*1024*50) '50MB

'temp2 = space(1024*1024*50) '50MB

temp2 = space(1024*1024*50) '50MB

'temp1="" '開關變數

temp1="" '開關變數

temp1="" '開關變數

temp2 = space(1024*1024*50) '50MB

'temp1="" '開關變數

temp1 = space(1024*1024*50) '50MB

'temp1="" '開關變數

temp1="" '開關變數

temp1="" '開關變數

temp1 = space(1024*1024*50) '50MB

temp1 = space(1024*1024*50) '50MB

temp1="" '開關變數

<% %>內是否有內容的區別(包括注釋)

<meta http-equiv='refresh' content='4;url=http://localhost/memory_test.ASP'>
<script language=vbscript runat=server>
Dim temp1,temp2

temp1 = space(1024*1024*50) '50MB

for i = 0 to 5000000 ' 延遲
next

'temp1="" '開關變數

'temp2 = space(1024*1024*50) '50MB

for i = 0 to 5000000 ' 延遲
next

</script>
<%
'
%>

1.<% %>內無內容,記憶體不變化

2.<% %>只有一個 ' 號,記憶體開始變化

<% 與 <script language=vbscript runat=server> 的先後位置無關,但似乎只要 <% %> 內有內容,就會執行 <script language=vbscript runat=server></script> 內的代碼.但只要把<script language=vbscript runat=server></script> 替換成 <% %>,就會執行<% %>內的代碼,所以以後要注意兩者的混用.

<script language=vbscript>
Dim temp
temp = space(1024*1024*50) '50MB
'temp = ""
</script>

## Beyond APAC's No.1 Cloud

19.6% IaaS Market Share in Asia Pacific - Gartner IT Service report, 2018

## Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

## Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth \$300-1200 USD