Browsing this Thread:   1 Anonymous Users


 Bottom   Previous Topic   Next Topic  Register To Post



memory to process huge number of files
Quite a regular
Joined:
2010/1/29 15:36
Group:
Registered Users
Posts: 17
Level : 2; EXP : 86
HP : 0 / 46
MP : 5 / 450
Offline
Hi All!

I developed a vb.net application to modify the header of DICOM files.
When I try to modify huge number of files (small size file) the windows process associated to my vb.net application takes lot of memory (eg. it reaches upto 1.5GB+ memory).

I think it's beacuse every time I process a file, a new DicomFile object is created. I would need to destroy this object after the processing. But I couldn't find a "dispose" method.

I tried also to work within a DicomThread, as Marco posted some time ago (I re-attached the sample code at the end of my post), but the problem of the memory is not solved.
It sounds strange to me, because I thought that once a DicomThread is terminated, then all the objects created in the Thread are automatically destroyed.

Please, can you help me to solve this issue? It's outstanding for my application, beacuse we always need to process a lot of files!

I thank you in advance!
Sara.


Here's the sample code that Marco posted some time ago. It's very similar to my code!


====================
Class MainDicomThread
Inherits DicomThread

Protected Overrides Sub Execute()
Dim theDicomFile As DicomFile = New DicomFile

theDicomFile.Read("C:\Temp\001.dcm")
theDicomFile.DataSet.Set("0x00100030", VR.DA, "19990202")
theDicomFile.Write("C:\Temp\001_changed.dcm")

End Sub

End Class ' MainDicomThread
'==========================



'
' Contains the entry point.
'
'================
Module DvtkScript

'
' Entry point of this Visual Basic Script.
'
'-------
Sub Main(ByVal CmdArgs() As String)

VisualStudioMain()

End Sub 'Main

Sub VisualStudioMain()
Dvtk.Setup.Initialize()

Dim theThreadManager As ThreadManager = New ThreadManager

Dim theMainDicomThread As MainDicomThread = New MainDicomThread
theMainDicomThread.Initialize(theThreadManager)

' Set the identifier.
theMainDicomThread.Options.Identifier = "Thread identifier"

' No results gathering needed.
theMainDicomThread.Options.StartAndStopResultsGatheringEnabled = False

' Put the temporary pix files here.
theMainDicomThread.Options.DataDirectory = "C:\Temp"

' Show activity logging
Dim theHliForm As HliForm = New HliForm
theHliForm.AutoExit = False
theHliForm.Attach(theMainDicomThread)

' Start the actual execution of theMainDicomThread.
theMainDicomThread.Start()

' Wait until all threads have finished executing.
theThreadManager.WaitForCompletionThreads()

Dvtk.Setup.Terminate()

End Sub

End Module ' DvtkScript
'======================

Posted on: 2010/11/4 9:22
Transfer the post to other applications Transfer


Re: memory to process huge number of files
Webmaster
Joined:
2006/10/12 14:45
From Best, Netherlands
Group:
Webmasters
Registered Users
Core Developers
Content Owners
Posts: 259
Level : 15; EXP : 5
HP : 0 / 351
MP : 86 / 6785
Offline
Hi Sara,

there are some known memory issues with the DVTk Library. Although all allocated memory should indeed be released when a DICOM Thread is destroyed this is not the case.
In the lower C/C++ layers are still some hard to find memory leaks.
My suggestion would be to do the open en modification of the DICOM files in a separate application process and use a control process to iterate through all the DICOM files. This ensures memory is released.

Good luck, Floris.

Posted on: 2010/11/5 8:26
Transfer the post to other applications Transfer


Re: memory to process huge number of files
Quite a regular
Joined:
2010/1/29 15:36
Group:
Registered Users
Posts: 17
Level : 2; EXP : 86
HP : 0 / 46
MP : 5 / 450
Offline
Thank you very much for the quick reply!
I'll do as you're suggesting!
Sara

Posted on: 2010/11/5 9:11
Transfer the post to other applications Transfer


Re: memory to process huge number of files
Quite a regular
Joined:
2010/3/23 15:01
Group:
Registered Users
Posts: 24
Level : 3; EXP : 62
HP : 0 / 65
MP : 8 / 607
Offline
I don't know how exactly things works out inside Dvtk libraries, but maybe defining only one single dicomFile variable can be useful about this, you should try it.

Class MainDicomThread
Inherits DicomThread

Dim theDicomFile As DicomFile = Nothing;

Protected Overrides Sub Execute()

If theDicomFile Is Nothing Then
theDicomFile = New DicomFile
End If

theDicomFile.Read("C:\Temp\001.dcm")
theDicomFile.DataSet.Set("0x00100030", VR.DA, "19990202")
theDicomFile.Write("C:\Temp\001_changed.dcm")

End Sub

End Class ' MainDicomThread

Posted on: 2010/11/12 10:28
Transfer the post to other applications Transfer


Re: memory to process huge number of files
Quite a regular
Joined:
2010/1/29 15:36
Group:
Registered Users
Posts: 17
Level : 2; EXP : 86
HP : 0 / 46
MP : 5 / 450
Offline
Hi Noldor,
thank you for your suggestion.

I tried it, but the memory issue was not solved!
I finally worked it out by handling the processing of DICOM files in a separate application process, as suggested by Floris.

Thank you All,
Best Regards,
Sara.

Posted on: 2010/11/23 12:54
Transfer the post to other applications Transfer


Re: memory to process huge number of files
Not too shy to talk
Joined:
2011/2/18 3:19
Group:
Registered Users
Posts: 5
Level : 1; EXP : 34
HP : 0 / 8
MP : 1 / 56
Offline
Hi,Sara,
thank you for your suggestion.

Posted on: 2011/3/2 3:48
_________________
silk duvetsSilk Beddingwww.revesilkdirect.com/silk-duvets-c-1.html
www.ugg-style.com
www.monosilk.com
Transfer the post to other applications Transfer


Re: memory to process huge number of files
Just popping in
Joined:
2011/3/7 6:12
From Weehawken
Group:
Registered Users
Posts: 1
Level : 1; EXP : 0
HP : 0 / 0
MP : 0 / 0
Offline
Gone through the tutorial but my connections are making some problem...Will check this once more.

Posted on: 2011/3/7 6:24
_________________
Auckland Airport Parking
Transfer the post to other applications Transfer


Re: memory to process huge number of files
Just popping in
Joined:
2011/3/14 2:06
Group:
Registered Users
Posts: 1
Level : 1; EXP : 0
HP : 0 / 0
MP : 0 / 0
Offline
I check it twice along.

Posted on: 2011/3/14 2:20
_________________
silk duvets
Belle Silk
Transfer the post to other applications Transfer



 Top   Previous Topic   Next Topic

 Register To Post


You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.

[Advanced Search]