An experimental report on the release of ASP memory
Source: Internet
Author: User
Experiment Objective: To verify the value of active free memory variable.
Experiment Original code:
<script Language=vbscript runat=server>
Dim TEMP1,TEMP2
' Temp1 = Space (1024*1024*50) ' 50MB
For i = 0 to 5000000 ' latency
Next
' temp1= ' "' Switch variable
' Temp2 = Space (1024*1024*50) ' 50MB
For i = 0 to 5000000 ' latency
Next
Response.Write "<meta http-equiv= ' refresh ' content= ' 4;url=http://localhost/memory_test.asp ' >"
</script>
Memory Change screenshot 1:
Screenshot Explanation:
CPU waveform changes are caused by automatic page refresh, do not care! All we have to observe is a change in the memory line. This is the original state where the memory line remains unchanged.
OK, the following experiment is officially started:
First step:
Put the original code in the
' Temp1 = Space (1024*1024*50) ' 50MB
The previous annotation number ' removed, changed to
Temp1 = Space (1024*1024*50) ' 50MB
And then watch the memory change for some time.
Memory Change screenshot 2:
Results:
The square wave begins to appear in memory.
Step Two:
And then put
' Temp2 = Space (1024*1024*50) ' 50MB
The previous annotation number ' removed, changed to
Temp2 = Space (1024*1024*50) ' 50MB
Memory Change screenshot 3:
Results:
The square wave is taller than the original one layer, becomes the ladder shape.
Step Three:
And then put
' temp1= ' "' Switch variable
The previous annotation number ' removed, changed to
temp1= "" ' Switch variable
See if you can free the memory space occupied by the first variable
Memory Change screenshot 4:
Results:
It was clear that the second wave-front was gone, and it appeared that the release was successful.
Fourth Step:
We first restore the code to the original code, and so the memory smooth down, then the first three steps to do a quick, so that in the same screenshot to compare the changes in memory.
Memory Change screenshot 5:
Results:
You can clearly see the difference in three different situations. No LUN execution time and memory footprint, the active release of the variable is better than the passive release.
Fifth Step:
Then the third step of the code, put
temp1= "" ' Switch variable
Temp2 = Space (1024*1024*50) ' 50MB
Change into
' temp1= ' "' Switch variable
Temp1 = Space (1024*1024*50) ' 50MB
Memory Change screenshot 6:
Results:
Look at the next step before you get to the conclusion.
Sixth step:
Put
' temp1= ' "' Switch variable
Change into
temp1= "" ' Switch variable
See if the results will be different.
Memory Change screenshot 7:
Results:
With the same variable name, even if the value again, the original occupied space can not be released or replaced, and so the program passive release, the use of time than manual slow.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service