AnsweredAssumed Answered

Issues with memory climbing as I load files - Memory leak?

Question asked by Eric Snyder on Jul 3, 2018
Latest reply on Jul 3, 2018 by Eric Snyder

I have a VB.NET app that iterates over a set of paths and opens files. Once the files are open I iterate the features and then close all docs. MY issue is that after some point the app just locks up. There are no loops that could become infinite loops. I left it to run overnight and it was locked up. When I check memory usage on the Solidworks process it was using 3,567,915 k or so.


I terminated the session of Solidworks, restarted manually and reloaded the file it was hung on. The new session of Solidworks was using about 500,000k memory or so.


The code is too long to post but I basically do this in pseudo code:


Get list of file using System directory services.

Filter some files out of the list for various reasons.

Open Solidworks by using:

swApp = New SldWorks.SldWorks


Iterate the file paths

        If File.Exists(path) Then

            Select Case System.IO.Path.GetExtension(path).ToUpper

                Case ".SLDASM"

                    docType = swDocumentTypes_e.swDocASSEMBLY

                Case "SLDPRT"

                    docType = swDocumentTypes_e.swDocPART

                Case Else

                    Return Nothing

            End Select

            swPart = swApp.OpenDoc6(path, docType, swOpenDocOptions_e.swOpenDocOptions_Silent, "", errors, warnings)


            Get some data from the file

            Close the file using:


End iteration

Is there some kind of garbage collecting I need to be doing?

Anybody have any ideas?


EDIT: By the way...If I open a new session of Solidworks it takes up something like 150,000K of memory.

Windows 7 Pro 64bit machine

16G ram

Solidworks 2018 SP 0