Re: Potential Memory Leak with DataSet ?
From: William Ryan eMVP (dotnetguru_at_comcast.nospam.net)
Date: 05/28/04
- Next message: Saul: "Re: Form Show"
- Previous message: Alex Feinman [MVP]: "Re: PInvoke'd strings seem to be different from what is sent"
- In reply to: Cube: "Re: Potential Memory Leak with DataSet ?"
- Next in thread: Cube: "Re: Potential Memory Leak with DataSet ?"
- Reply: Cube: "Re: Potential Memory Leak with DataSet ?"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 28 May 2004 01:37:42 -0400
-- W.G. Ryan MVP Windows - Embedded http://forums.devbuzz.com http://www.knowdotnet.com/dataaccess.html http://www.msmvps.com/williamryan/ "Cube" <anonymous@discussions.microsoft.com> wrote in message news:945BF08E-6655-4284-859B-6107CFAA6D00@microsoft.com... > Thanks for the feedback, > > To be honest my job is seriously on the line if I don't get this fixed and > it's getting me down :o( Any help is hugely welcome. > > Some more info. on my problem ... > > 1. User Clicks Login and is Validated against database (username/pwd using SQLSelectCommand) > 2. InitialiseApplication() is called which launches a worker thread that loads the > database into dataset (about 16,000 records), while the UI thread updates > a progress bar. Worked Thread sets a Global Boolean Flag to indicate when > it's finished, progress bar stops. Takes about 30 seconds. > 3. RefreshDetails() is called which binds list boxes, etc.to the tables in the dataset. > The layout of my app is several panels containing these controls with show/hide > being used. > > 4. Person collects information moving from location to location. For each item the > user selects a record is inserted/updated in the appropriate table in the dataset. > > 5. On a periodic basis which does vary (some may do it twice a day, others once a > week) a synchronisation takes place. The database is updated from the dataset. > Once the database is updated, a connection is established to the SQL Server using > GPRS, all the ususal Merge Replication activity occurs and no conflicts are reported. > After the Sync a Worked Thread is created to load the database back up into > the dataset, while the UI thread updates a progress bar. The Worked Thread sets > a Global boolean to indicate this it's finished. User Controls are rebound as in step 3. > > Problem... > I can't reproduce the error I'm getting consistenly as it seems to happen sporadically > and usually over a period of time. When the error does happen it seems that: > - Some of the data is not making it from the dataset to the CE database. > - When a sync occurs most of my user controls do not contain any items. > > Question... > 1. Is my use of threads messing things up? Maybe the dataset is being accessed by > different threads and that's screwing things up? It certainly could be depending on how things are done. However I don't think this problem sounds like a threading problem. It'd help if you showed this code.. it sounds like it may be a thread issue in the inconsistency of it, on the other hand, filling a dataset doesn't seem like this would be the symptom. I'm guessing you've locked everything with synclock? > 2. Is my dataset too large - 16,000 records (2MB) ? Yes, but that's probably not the cause of this problem That's a ton of data to load on a PDA, unless of course they absolutely need it all. The main thing I'd be concerned about is concurrency problems if I had many things with that much data out there. > 3. Is my dataset being held in memory too long? User *closes* app (i.e. clicks on > X), which we know doesn't close it in the traditional sense, and opens it 2-3 days > later, before syncing. Maybe this ties in with Q1? I highly doubt it unless you aren't saving the dataset's state when the form closes by sending it to SQL Ce or some other method. If you could be losing changes then yes, it's possible but I'm guessing something this obvious probably isn't being overlooked. > 4. I came across this issue on MS KB and can confirm that I don't explicity call Dispose() > will it affect me? http://www.kbalertz.com/Feedback_824462.aspx I doubt it, if you called dispose and that was the problem, it wouldn't pick and choose a few rows to not update. > > Any help is hugely appreciated. Right off the bat, I'd look for a few things... What does your exception handling look like? Are you eating any exceptions in there and not notifying the user or logging it somehow in a file? This would be the first thing I'd probably look for but I don't know your app. If records are disappearing, there's something causing it. Either the user is deleting them or something is going wrong and no exceptions are showing up (well, there are certianly a few other possibilities). Anyway, if you were eating an exception then it could certianly mask whatever is happening. Any problems w/ replication that you know of? have you gotten any errors there? When do you save the data from the dataset back to CE? Is it possible that say 100 changes have been made for example and I hit Save so they head back to the CE database. Now I change 4 more but don't send them back to CE. Everything is Synced up but those 4 haven't made it to CE so they don't get transferred? How are you verifying the missing records? That's probably the most important thing in tracking it down b/c it might provide insigth into where it's happening. Let me know and hopefully we can track it down. You may also want to send Rob Tiffany an email. He wrote a killer book on SQL Server CE and the Compact Framework and has done quite a bit with it. I have done a fair amount but not as much as Rob and if it's a common problem, he'll probably know of it. You can post to his forum here http://forums.devbuzz.com/Rob_Tiffany/forumid_47/tt.htm Or you can try him at www.hoodcanalmobility.com HTH Bill
- Next message: Saul: "Re: Form Show"
- Previous message: Alex Feinman [MVP]: "Re: PInvoke'd strings seem to be different from what is sent"
- In reply to: Cube: "Re: Potential Memory Leak with DataSet ?"
- Next in thread: Cube: "Re: Potential Memory Leak with DataSet ?"
- Reply: Cube: "Re: Potential Memory Leak with DataSet ?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|