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 13:23:30
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Collection is removed from memory after a while
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:
01588067
Vues:
59
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?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform