Click here to Skip to main content
15,887,746 members
Home / Discussions / C#
   

C#

 
GeneralRe: Memory leak trouble with Linq to Sql and multiple threads Pin
Dave Kreskowiak10-Jan-16 8:29
mveDave Kreskowiak10-Jan-16 8:29 
GeneralRe: Memory leak trouble with Linq to Sql and multiple threads Pin
Gerry Schmitz10-Jan-16 9:04
mveGerry Schmitz10-Jan-16 9:04 
GeneralRe: Memory leak trouble with Linq to Sql and multiple threads Pin
JD8610-Jan-16 16:33
JD8610-Jan-16 16:33 
GeneralRe: Memory leak trouble with Linq to Sql and multiple threads Pin
Gerry Schmitz10-Jan-16 17:40
mveGerry Schmitz10-Jan-16 17:40 
GeneralRe: Memory leak trouble with Linq to Sql and multiple threads Pin
JD8611-Jan-16 5:01
JD8611-Jan-16 5:01 
GeneralRe: Memory leak trouble with Linq to Sql and multiple threads Pin
JD8612-Jan-16 6:24
JD8612-Jan-16 6:24 
GeneralRe: Memory leak trouble with Linq to Sql and multiple threads Pin
Luc Pattyn12-Jan-16 15:50
sitebuilderLuc Pattyn12-Jan-16 15:50 
GeneralRe: Memory leak trouble with Linq to Sql and multiple threads Pin
JD8612-Jan-16 16:29
JD8612-Jan-16 16:29 
Hey Luc!

Glad to hear you like my coding style... its been completely self taught (with help from random people on the web) so never really knew LOL.

1) I am running 32-bit process. Memory is a virtual machine running 2008 R2 with 16GB of memory (4GB is used normally)

2) Here is the breakdown:
Users: 4333 rows
Message Tracking Logs: 1432284 rows
Mailbox Sizes: 2209537 rows
Database Sizes: 10520
History Stats table: 69806 rows

3) Get_MessageTrackingLogsTask normally would run every 720 minutes. To speed up the testing phase I changed it to every 60 minutes (along with the rest of the tasks)

4) The service starts out at 5MB of memory. From 6pm to 9pm tonight it has climbed to 314MB. I usually end up stopping the service around 2.8GB used. I've let it just go once and it crashed when it hit the max memory for 32-bit process) Here is intervals:
GetDisabledUsers has ran 180 times (every 10 min) [Users table]
GetLockedUsers has ran 180 times (Every 10 min) [Users table]
GetMailboxSizes has ran 3 times (every 60 min) [Mailbox sizes table]
GetMailboXDatabaseSizes has ran 6 times (every 30 min) [Database sizes table]
GetMessageTrackingLogs has ran 3 times (every 60 min) [Message Tracking table]
FindMissingData has ran 9 times (every 20 min) [Users table]
UpdateDatabaseHistory has ran 3 times (every 60 min) [History Stats table]

5) I've only let it crash once so I don't know where it crashed. I don't see any errors and it continues to function fine till it runs out of memory. This does happen everytime I run it.. I've tried removing the db.Connection.Open() and currently (right now) i'm trying using the "using" statement.

6) I can make the memory climb by increasing the intervals. So one of my tasks is causing the issue but examining the code over and over I can't find where it possibly is doing it Frown | :-(

7) It probably would take about 2 days for it to fully climb and crash. I would setup something to capture a memory dump when it crashes but it would take a few days.



One thing I can try is to increase the interval for all tasks to like 999999 minutes except for one (set at 10 min). Then I can slowly include each task until I see the memory problem.

But right now it has gone from 5MB to 314MB in 3 hours. It should just be querying from Exchange/AD and dumbing the data to SQL and disposing of all of it... so technically the memory should go back down right?
GeneralRe: Memory leak trouble with Linq to Sql and multiple threads Pin
Luc Pattyn12-Jan-16 17:16
sitebuilderLuc Pattyn12-Jan-16 17:16 
GeneralRe: Memory leak trouble with Linq to Sql and multiple threads Pin
JD8612-Jan-16 17:30
JD8612-Jan-16 17:30 
GeneralRe: Memory leak trouble with Linq to Sql and multiple threads Pin
Luc Pattyn12-Jan-16 17:46
sitebuilderLuc Pattyn12-Jan-16 17:46 
GeneralRe: Memory leak trouble with Linq to Sql and multiple threads Pin
JD8614-Jan-16 4:07
JD8614-Jan-16 4:07 
GeneralRe: Memory leak trouble with Linq to Sql and multiple threads Pin
JD8614-Jan-16 4:26
JD8614-Jan-16 4:26 
GeneralRe: Memory leak trouble with Linq to Sql and multiple threads Pin
JD8614-Jan-16 14:05
JD8614-Jan-16 14:05 
GeneralRe: Memory leak trouble with Linq to Sql and multiple threads Pin
Luc Pattyn14-Jan-16 18:26
sitebuilderLuc Pattyn14-Jan-16 18:26 
GeneralRe: Memory leak trouble with Linq to Sql and multiple threads Pin
JD8617-Jan-16 16:09
JD8617-Jan-16 16:09 
GeneralRe: Memory leak trouble with Linq to Sql and multiple threads Pin
Luc Pattyn17-Jan-16 17:10
sitebuilderLuc Pattyn17-Jan-16 17:10 
GeneralRe: Memory leak trouble with Linq to Sql and multiple threads Pin
JD8617-Jan-16 17:21
JD8617-Jan-16 17:21 
GeneralRe: Memory leak trouble with Linq to Sql and multiple threads Pin
Luc Pattyn17-Jan-16 18:32
sitebuilderLuc Pattyn17-Jan-16 18:32 
GeneralRe: Memory leak trouble with Linq to Sql and multiple threads Pin
JD8619-Jan-16 3:26
JD8619-Jan-16 3:26 
GeneralRe: Memory leak trouble with Linq to Sql and multiple threads Pin
JD8621-Jan-16 4:04
JD8621-Jan-16 4:04 
GeneralRe: Memory leak trouble with Linq to Sql and multiple threads Pin
Luc Pattyn21-Jan-16 15:06
sitebuilderLuc Pattyn21-Jan-16 15:06 
Questionbetter way to Linqify this ? Pin
BillWoodruff9-Jan-16 2:01
professionalBillWoodruff9-Jan-16 2:01 
AnswerRe: better way to Linqify this ? Pin
Sascha Lefèvre9-Jan-16 2:25
professionalSascha Lefèvre9-Jan-16 2:25 
GeneralRe: better way to Linqify this ? Pin
BillWoodruff11-Jan-16 8:06
professionalBillWoodruff11-Jan-16 8:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.