![]() |
|
#1
|
|||
|
|||
|
Run out of memory?
I feel really simple, but I can not figure this out. When I run the following loop the memory just climbs and climbs until I run out of memory.
string[] files = Directory.GetFiles(dir, "*.mp3"); foreach (string songTitle in files) { this.myTagReader.Read(songTitle); Song s = new Song(); s.Band = myTagReader.Artist; s.DateRecorded = myTagReader.Year.ToString(); s.Title = myTagReader.Title; this.myDataLayer.insertInitialSong(s, songID++); this.myTagReader.Clear(); } By the time I read 5000 songs or so I am hitting 1,889,020k Vitural Size in Process Explore and the PF Usage in Task Manager is over 2.0 GB. I have played around commenting lines in and out and it is the line this.myTagReader.Read(songTitle); that causes the memory to rise. I tried the following: using(UltraID3 myTagReader = new UltraID3 () { foo } But ran against the not implicitly convertible to IDisposable. Any suggestions appreciated. cheers bob |
|
#2
|
||||
|
||||
|
You're creating a new instance of the Song class with each iteration. Maybe you could try using a single instance and implement a method similar to Clear and just clear out the property values of the Song instance on each iteration. Maybe try commenting out the Song code to see if it's the UltraID3 class that's causing the memory leak.
- Mitchell S. Honnert |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|