Releasing memory (continuation)
From: nisant (nisant_at_discussions.microsoft.com)
Date: 09/28/04
- Next message: Bonj: "RE: Excel automation in VB"
- Previous message: Jethro: "FTPPutFile strange behaviour"
- Next in thread: Tony Proctor: "Re: Releasing memory (continuation)"
- Reply: Tony Proctor: "Re: Releasing memory (continuation)"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 28 Sep 2004 02:33:02 -0700
I "refresh" the thread
http://communities2.microsoft.com/communities/newsgroups/en-us/default.aspx?&guid=&sloc=en-us&dg=microsoft.public.vb.general.discussion&p=1&tid=9e29a210-89db-40ef-80b7-77f42b00681a
because many solutions have been proposed and I wanted to verify and give
results to the ng.
I verified objects collection vs objects array (no doubt about the fact that
UDTs array would be the fastest).
That's what appened working with 100000 instances:
OBJECTS COLLECTION
--------
Dim coll As New Collection
For i = 0 To 100000
coll.Add New myObject, CStr(i)
Next i
Allocation: 8 seconds
For i = 0 To 100000
coll.Remove CStr(i)
Next i
Release: 35 seconds
For i = 0 To 100000
coll.Remove 1
Next i
Release: 33 seconds
For i = 100000 To 0 Step -1
coll.Remove i
Next i
Killed after 2 minutes, only about 10000 objects released
For i = 100000 To 0 Step -1
coll.Remove CStr(i)
Next i
Release: 34 seconds
Set coll = Nothing
Release: 32 seconds
OBJECTS ARRAY
-------
Dim arr(100000) As myObject
For i = 0 To UBound(arr, 1)
Set arr(i) = New myObject
Next i
Allocation: 2 seconds
For i = 0 To UBound(arr, 1)
Set arr(i) = Nothing
Next i
Release: 17 seconds
For i = UBound(arr, 1) To 0 Step -1
Set arr(i) = Nothing
Next i
Release: 17 seconds
I also tried a dynamic array released by Redim arr(0); same elapsed as above:
Allocation: 2 seconds
Release: 17 seconds
COMMENTS:
a) Arrays are very faster than Collections
b) Rank
1 - Set coll = Nothing
2 - Removing 1st ordinal item
3 - Removing in reversed key order
4 - Removing in key order
5 - Removing in reversed ordinal order (geologic time)
c) Release time in collection test seems to be spent 1/2 navigating thru the
collection, 1/2 releasing memory. Total time about 34 seconds, only 17
seconds the memory release time, as derived from array test (where non
navigation occurs).
d) It seems that nothing can speed up memory release of instances (arrays
perform better because there is no collection structure to navigate thru, but
memory release time remains the same).
So one question remains I can't imagine the answer:
What does system do to release the process memory instantly when I kill the
process?
Many many many thanks for an answer.
PS
About Scripting.Dictionary:
I hope I will try soon
About SQL Server:
My in-memory DB is loaded from a disk database (MS Access).
I choose an in-memory structure to process data because of speed needs
Tank you nevertheless.
- Next message: Bonj: "RE: Excel automation in VB"
- Previous message: Jethro: "FTPPutFile strange behaviour"
- Next in thread: Tony Proctor: "Re: Releasing memory (continuation)"
- Reply: Tony Proctor: "Re: Releasing memory (continuation)"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|