Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Collection is removed from memory after a while
Message
De
15/11/2013 14:33:10
 
 
À
15/11/2013 13:23:30
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01588067
Message ID:
01588095
Vues:
34
J'aime (1)
Please get rid of your object collections (as fast as you can). They are outdated

(1) Boxing/unboxing overhead
(2) I see you loop to find whether an item is in

If 'This is executed hundreds of thousands of times per hour' you will experience a huge performance boost

>Here is one item that went ok on test but caused an unexpected situation in production. The following is a method which checks a collection for the presence of an item:
>
>
>    ' Return True or False if an image is loaded in memory
>    ' expC1 Name
>    Public Function IsImageInMemory(ByVal tcName As String) As Boolean
>        Dim lcName As String = ""
>        Dim lcNameToSearch As String = ""
>        Dim llFound As Boolean = False
>        Dim loObject As Object
>
>        ' Initialization
>        lcNameToSearch = UCase(Trim(tcName))
>
>        ' For each image in the collection
>        For Each loObject In oProcess.oApp.oImage
>
>            ' Initialization
>            lcName = loObject(1)
>
>            ' If we have found it
>            If UCase(lcName) = lcNameToSearch Then
>                llFound = True
>
>                ' Initialization
>                nWidth = loObject(2)
>                nHeight = loObject(3)
>
>                Exit For
>            End If
>
>        Next
>
>        Return llFound
>    End Function
>
>
>This is executed hundreds of thousands of times per hour. After several hours in production with this new version, I have found out that the oProcess.oApp.oImage collection is not acting as it should. It returns the message "Object reference not set to an instance of an object." at this level:
>
>at Microsoft.VisualBasic.Collection.GetEnumerator()
> at Framework.ProcessWeb.IsImageInMemory(String tcName)
>
>I thought using a collection would be safe enough to check for in memory content for several items. Should I have used an array instead?
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform