|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Dataset, SqlDataAdapter, memory and you in .net 2I am having severe memory issues when opening Datasets in .net 2.0. A web-based app will cause the worker process to recycle on a heavy-duty server after just a few client connections, and a windows app will bring the machine to a crawl. My testing code is as follows. It is used as the source for a report that can obviously be run many times. Even if I isolate the code to just opening and closing the data (as shown below), major problems still occur. Have I left anything out? using (SqlDataAdapter TheAdapter = new SqlDataAdapter("select * from customermaster", DoodConnection)) { using (DataSet TheCustomers = new DataSet()) { TheCustomers.Tables.Add("CustomerMaster"); TheAdapter.Fill(TheCustomers, "CustomerMaster"); TheAdapter.Dispose(); TheCustomers.Dispose(); GC.Collect(); GC.WaitForPendingFinalizers(); } } The "using" was added based on a post I found but did not help at all. Adding calls to GC helped a bit, but in the long run this is ridiculous!!! The 'using' statement automtically disposes all the objects when the
statement is finished. So you don't need to duplicate that. The suggestion was to use the using statement *instead* of calling Dispose. The main problem I think is that you are calling the GC yourself - why? I think you should just let it do its job when it feels it is necessary. How many rows of data does 'customermaster' have? How many columns? Show quote "the_chad" <the_c***@discussions.microsoft.com> wrote in message news:BB8C7DCD-C935-4E07-84A3-3356ABEDF554@microsoft.com... > hey doods and doodettes. > > I am having severe memory issues when opening Datasets in .net 2.0. A > web-based app will cause the worker process to recycle on a heavy-duty > server > after just a few client connections, and a windows app will bring the > machine > to a crawl. My testing code is as follows. It is used as the source for > a > report that can obviously be run many times. Even if I isolate the code > to > just opening and closing the data (as shown below), major problems still > occur. Have I left anything out? > > using (SqlDataAdapter TheAdapter = new SqlDataAdapter("select * from > customermaster", DoodConnection)) > { > using (DataSet TheCustomers = new DataSet()) > { > TheCustomers.Tables.Add("CustomerMaster"); > TheAdapter.Fill(TheCustomers, "CustomerMaster"); > TheAdapter.Dispose(); > TheCustomers.Dispose(); > GC.Collect(); > GC.WaitForPendingFinalizers(); > } > } > > The "using" was added based on a post I found but did not help at all. > Adding calls to GC helped a bit, but in the long run this is ridiculous!!! > > The main problem I think is that you are calling the GC yourself - why? Wrong. That is NOT the main problem. If you noticed, I said that adding the calls to GC actually helped a bit. > How many rows of data does 'customermaster' have? How many columns? This is a large Dataset, but that should not be the focus of the problem. Memory should not be sucked up by subsequent requests to the dataset. When the set is disposed, it should release the memory or at least reuse it. Instead, each new request grabs more memory. I think it is the main problem because you shouldn't be getting enormous
amounts of data from the database, and that you should *not* be manually invoking the GC and having it run constantly! The large dataset is exactly what is the focus of this problem. Memory is not reclaimed immediately just because an object is disposed. In fact, calling Dispose is just done to clean up the object and have it release all of its unmanaged resources. It is not done to 'reclaim' memory somehow immediately. The object will stay in memory until the GC decides it needs to go clean up and get more memory. It sounds like your dataset is enormous, and the GC can't run fast enough to reclaim memory before it is needed again. I think you have mistaken the dataset for a in memory database that needs to hold a ton of data. You should only get the data you need from the database when you need it. Change your code to retrieve only 5 rows of data, remove the calls to GC and all your memory problems will go away. Show quote "the_chad" <thec***@discussions.microsoft.com> wrote in message news:1D885D7A-9B94-45C9-A02A-8D44D9865DAD@microsoft.com... >> The main problem I think is that you are calling the GC yourself - why? > Wrong. That is NOT the main problem. If you noticed, I said that adding > the calls to GC actually helped a bit. > >> How many rows of data does 'customermaster' have? How many columns? > This is a large Dataset, but that should not be the focus of the problem. > Memory should not be sucked up by subsequent requests to the dataset. > When > the set is disposed, it should release the memory or at least reuse it. > Instead, each new request grabs more memory. I'm not disputing that, I haven't even run this code.
I am pointing out a problem with the premise of the code to begin with. I also tried to give an explanation of why it's not working as you expect and not solving all your memory problems. If you are not interested in suggestions and advice, then I'm not sure I understand why you posted here to begin with. Show quote "the_chad" <thec***@discussions.microsoft.com> wrote in message news:D59BA8C9-1E8C-4CF6-81D4-73D4A670B2AA@microsoft.com... > The addition of GC statements helped. Are you disputing that? I AM interested in the suggestions. However if you are saying the only answer
to the problem is paring down the dataset, then that is unacceptable. I am not mistaking the dataset for an "in-memory database", I am using it for one of the many things it is meant for - a source for a report. The fact is the memory is never reclaimed and everytime you create the dataset, more memory is sucked up and retained. Forever. So what can I do to release that memory? I do not have this problem in earlier versions of .net. If you have identical code, that in 1.1 does not cause any problems, but in
2.0 brings the server down, I would report it as a problem to Microsoft. Since you say how many rows you were retrieving, despite me asking, and you were doing a 'select *', my suggestion was to get the data on a need by need basis. Meaning one page of a report at a time, one 'customer' at a time, etc. Since I obviously have no way of knowing exactly what you are trying to do, I was just taking a guess at what is the most likely think you were doing. If you don't want people guessing, then you may want to provide more information or answer their follow up questions. Show quote "the_chad" <thec***@discussions.microsoft.com> wrote in message news:38BC8378-8D7B-457E-9BF3-2E99BAB412ED@microsoft.com... >I AM interested in the suggestions. However if you are saying the only >answer > to the problem is paring down the dataset, then that is unacceptable. I > am > not mistaking the dataset for an "in-memory database", I am using it for > one > of the many things it is meant for - a source for a report. The fact is > the > memory is never reclaimed and everytime you create the dataset, more > memory > is sucked up and retained. Forever. So what can I do to release that > memory? I do not have this problem in earlier versions of .net. Maybe we're not on the same page. I didn't think I left anything up for
guesswork. I just wanted to know how to reclaim or reuse the dang memory that is sucked away by subsequent creations of a particular dataset. Getting the customers one at a time would not work efficiently in this reporting paradigm that is based on Crystal Reports. I do appreciate your time, Marina. And by the way, you are hot! 1) what about your SqlConnection. Are you closing that? That's where the
using statement will benefit you. 2) "you are hot" - are you kidding me? What is this, 1950? Show quote "the_chad" <thec***@discussions.microsoft.com> wrote in message news:5FC0C452-308D-44D5-998D-F335ECE7F7D8@microsoft.com... > Maybe we're not on the same page. I didn't think I left anything up for > guesswork. I just wanted to know how to reclaim or reuse the dang memory > that is sucked away by subsequent creations of a particular dataset. > Getting > the customers one at a time would not work efficiently in this reporting > paradigm that is based on Crystal Reports. I do appreciate your time, > Marina. And by the way, you are hot! I'll say, especially considering he's never seen me!
Show quote "Julie Lerman" <jlermanATNOSPAMPLEASEthedatafarm.com> wrote in message news:%23KcRNirUGHA.5108@tk2msftngp13.phx.gbl... > 1) what about your SqlConnection. Are you closing that? That's where the > using statement will benefit you. > > 2) "you are hot" - are you kidding me? What is this, 1950? > > > "the_chad" <thec***@discussions.microsoft.com> wrote in message > news:5FC0C452-308D-44D5-998D-F335ECE7F7D8@microsoft.com... >> Maybe we're not on the same page. I didn't think I left anything up for >> guesswork. I just wanted to know how to reclaim or reuse the dang memory >> that is sucked away by subsequent creations of a particular dataset. >> Getting >> the customers one at a time would not work efficiently in this reporting >> paradigm that is based on Crystal Reports. I do appreciate your time, >> Marina. And by the way, you are hot! > > The chad,
>And by the way, you are hot! I was busy with an answer. However this extends any limit I have seen on these newsgroups. Marina is a professional who tries to help other people. For everybody active in these pages is your text and code with what you started a cruel. Therefore she was helping you in the right way, instead of giving a direct solution. Your code shows that you are probably a beginner or somebody who has learned something in the past century and want to keep his same way of doing things. As she expressed, if you don't want help, than don't ask for it only to tell to others that you did that. Cor Thanks Cor :)
Oy... Show quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:ueadShvUGHA.5288@TK2MSFTNGP14.phx.gbl... > The chad, > > >And by the way, you are hot! > > I was busy with an answer. However this extends any limit I have seen on > these newsgroups. > > Marina is a professional who tries to help other people. > > For everybody active in these pages is your text and code with what you > started a cruel. > > Therefore she was helping you in the right way, instead of giving a direct > solution. Your code shows that you are probably a beginner or somebody who > has learned something in the past century and want to keep his same way of > doing things. > > As she expressed, if you don't want help, than don't ask for it only to > tell to others that you did that. > > Cor > 1) You guys and girls need to lighten up. Seriously.
2) "You are hot" was only a GUESS. Especially since Marina's picture is one of the few not on the vb.net MVP page. I was just trying to introduce some sarcasm into the discussion (based on statements Marina made about guessing), but it fell on deaf ears. 3) "Your code shows that you are probably a beginner. . ." Of course the code was rudimentary; I clearly stated this was test code. I also asked if I had left anything out. And yes, I have just started to use .net 2.0, which is why I posted here. However, I have successfully completed some major data-driven .net projects since 2001 that have made the lives of thousands of people much easier, so I would hardly call myself a beginner. 4) ". . . don't ask for [help] only to tell to others that you did that." Well, what are we here for? I thought it was troubleshooting and analysis. Should I just stop the thread once someone gives me a suggestion, even if that suggestion has already been tested or will not work for the situation? 5) I do want help. Really. I just want to know why a large dataset-one that's just used for an instant-can consume and retain so much memory. By retain I mean for the life of the application. Of course when the dataset is smaller the problem is not as evident, but it IS still there. 6) I was not being sarcastic about appreciating any time spent on the reflection of my problem. I do appreciate all of you. Now, does anyone have any advice?? 1) from my previous reply: " what about your SqlConnection. Are you closing
that? That's where the using statement will benefit you." 2) " I was just trying to introduce some sarcasm into the discussion " Baloney. It was beyond inappropriate - but really just plain stupid. Show quote "the_chad" <thec***@discussions.microsoft.com> wrote in message news:B77279B1-0CF4-42F0-BF81-12C7F2CD14BC@microsoft.com... > 1) You guys and girls need to lighten up. Seriously. > > 2) "You are hot" was only a GUESS. Especially since Marina's picture is > one of the few not on the vb.net MVP page. I was just trying to introduce > some sarcasm into the discussion (based on statements Marina made about > guessing), but it fell on deaf ears. > > 3) "Your code shows that you are probably a beginner. . ." Of course the > code was rudimentary; I clearly stated this was test code. I also asked > if I > had left anything out. And yes, I have just started to use .net 2.0, > which > is why I posted here. However, I have successfully completed some major > data-driven .net projects since 2001 that have made the lives of thousands > of > people much easier, so I would hardly call myself a beginner. > > 4) ". . . don't ask for [help] only to tell to others that you did that." > Well, what are we here for? I thought it was troubleshooting and > analysis. > Should I just stop the thread once someone gives me a suggestion, even if > that suggestion has already been tested or will not work for the > situation? > > 5) I do want help. Really. I just want to know why a large dataset-one > that's just used for an instant-can consume and retain so much memory. By > retain I mean for the life of the application. Of course when the dataset > is > smaller the problem is not as evident, but it IS still there. > > 6) I was not being sarcastic about appreciating any time spent on the > reflection of my problem. I do appreciate all of you. Now, does anyone > have > any advice?? > > >what about your SqlConnection. Are you closing that? The connection string is sent directly to the adapter via the constructor. I failed to make it clear that my inappropriately named variable "DoodConnection" was a string. > Baloney. It was beyond inappropriate - but really just plain stupid. {that's a little harsh don't you think?} Upon further reflection, the statement was over the top. It was probably on the verge of sexism, and for that I apologize. I am a professional, but I also like to have fun with people. Sometimes, however, that fun is lost in textual conversations. I truely meant no harm-I just misjudged my audience's sense of humour and this medium's ability to transport it. but are you closing the connection? If you aren't, it would definitely be a
reason for your memory problems. Hopefully Marina will read the rest... Show quote "the_chad" <thec***@discussions.microsoft.com> wrote in message news:226656D1-6C76-401C-9F47-20ACBD1ADE54@microsoft.com... > >what about your SqlConnection. Are you closing that? > > The connection string is sent directly to the adapter via the constructor. > I failed to make it clear that my inappropriately named variable > "DoodConnection" was a string. > > >> Baloney. It was beyond inappropriate - but really just plain stupid. >> {that's a little harsh don't you think?} > > Upon further reflection, the statement was over the top. It was probably > on > the verge of sexism, and for that I apologize. I am a professional, but I > also like to have fun with people. Sometimes, however, that fun is lost > in > textual conversations. I truely meant no harm-I just misjudged my > audience's > sense of humour and this medium's ability to transport it. > but are you closing the connection? You mean TheAdapter.Dispose() does not take care of this? Do you have to close the connection for every type of command (select, update, delete) you have created with the adapter? Well, I went ahead and tried this but it did not help. > Hopefully Marina will read the rest... Cor, too, I suppose. Thanks!!Ok, I appreciate the apology. I do find it interesting that you went to look
my MVP profile up to either confirm or deny my hotness... In any case, disposing the adapter does not do anything to the connection it is using. Multiple adapters/commands could be referencing the same connection, and so any one of them wouldn't close a connection when it is getting dispose. Otherwise, an adapter that is out of scope that is getting GC'ed, would close a connection in its Dispose - but this connection might still be in scope and used elsewhere, and so this would be highly undesirable. The Fill method will open the connection if closed. And if the connection was closed when it started, it will close it once its done. If the connection was open to begin with, Fill will leave it alone. You are sending just the connection string, so that should manage the connection for you. I don't think you are having memory problems due to connection leaking - that would end up being a pooling issue. My best guess is that the GC is thrashing with trying to allocate huge chunks of memory, and then not being able to reclaim it fast enough. You still haven't told us how many rows your dataset ends up holding with how many columns in each row, so it's just a guess. Show quote "the_chad" <thec***@discussions.microsoft.com> wrote in message news:6CC8BE7F-274C-4180-BB59-8D1D256D679A@microsoft.com... >> but are you closing the connection? > You mean TheAdapter.Dispose() does not take care of this? Do you have to > close the connection for every type of command (select, update, delete) > you > have created with the adapter? Well, I went ahead and tried this but it > did > not help. > >> Hopefully Marina will read the rest... > > Cor, too, I suppose. Thanks!! > > > I do find it interesting that you went to look my MVP profile up to either confirm or deny my hotness...Hotness, huh? ;-) I really didn't mean any disrespect to you or your family. I hope you can tell them I am really not such a jerk after all! Anyway, back to business... I understand that if the connection was created separately that it would have to be closed separately. Now for the big answer, and you will probably shake your head in disgust, but here goes: There are 78 columns in the customerMaster, most of which are bit fields and small char/varchar fields (note there are no nchar/nvarchar fields). It also contains a few smalldatetime and decimal(9,2) fields. There are approximately 24,000 rows. Only managers would be interested in this plethora of data, but I am in the designing/testing phases and I wanted make sure the applications would handle the load under worst case scenario. I could probably pare out some of the columns, or create different reports for different types of customer data, but you know how managers are. In addition, I have tried smaller sets of data (579 rows)and I still see symptons of the problem. It seems to me that I could load this dataset, then dispose it, and have the memory available for the next run of the report. By available I mean available to the application, not necessarily the operating system. So maybe I could expect to see the worker process jump up to a couple hundred MB and stay there for a while, during which time the memory would be reserved for subsequent requests. But the memory never gets released, and subsequent requests consume more and more memory. Are these assumptions false? If so, why? Chad,
All the time do I have the idea that you are fetching to much data. No human can handle that. A dataset is a typical class, to handle using an UI the data. For a more serialized operation you can probably better use a DataReader and write the updates using the ExecuteNonQuery. Now back to your dataset and my first thought I had al the time. Why is there no "Where" clause in your SQL command. I have not the idea that this amount of Data is for a disconnected medium as a handheld or something like that. Using this amount of data will not alone bring you in performance problems. How you had the idea to handle updates from other users? This was my first thought reading the messages, now you have even committed that. Cor > All the time do I have the idea that you are fetching to much data. No human If I was a betting man (and I am) I would bet you are right. But I am > can handle that. setting this up for worse case scenario (WCS). > For a more serialized operation you can probably better use a DataReader and True, that would help, but I am thinking Crystal Reports will only take a > write the updates using the ExecuteNonQuery. dataset as its reoprt source. I am going to load this up and try anyway. > Now back to your dataset and my first thought I had al the time. Why is This system only receives updates once a day.> there no "Where" clause in your SQL command. WCS > Using this amount of data will not alone bring you in performance problems. > How you had the idea to handle updates from other users? Thanks, Cor. The Chad,
> Can paging than not be your friend.>> For a more serialized operation you can probably better use a DataReader >> and >> write the updates using the ExecuteNonQuery. > True, that would help, but I am thinking Crystal Reports will only take a > dataset as its reoprt source. I am going to load this up and try anyway. > http://www.vb-tips.com/default.aspx?ID=da78342b-9e47-4e81-916f-ba7a1d82b540 http://www.vb-tips.com/default.aspx?ID=5dbe894a-a7e6-434c-bd84-73494c71063f I hope this helps, Cor In one of the posts, I sort of gave an overview of how the GC works. In any
case, calling Dispose on an object does not mean that its memory is available to the application to use for other things. It's just not how it works. I am guessing even management does not want to see 24K worth of data all on the same page in the report. Therefore, I recommend you change your application to retrieve only the data required for the page currently being viewed. Not only will the report run faster because you will need far less data, but hopefully your memory issues will go away too. For me, this is sort of as much as I know and out of ideas. Maybe someone else on the newsgroup has some ideas. Otherwise you might need to open up a support case with MS. Show quote "the_chad" <thec***@discussions.microsoft.com> wrote in message news:95F9ABBD-D113-4EA3-8BB6-49F10A4794C4@microsoft.com... >> I do find it interesting that you went to look my MVP profile up to >> either > confirm or deny my hotness... > > Hotness, huh? ;-) I really didn't mean any disrespect to you or your > family. I hope you can tell them I am really not such a jerk after all! > > Anyway, back to business... > > I understand that if the connection was created separately that it would > have to be closed separately. > > Now for the big answer, and you will probably shake your head in disgust, > but here goes: There are 78 columns in the customerMaster, most of which > are > bit fields and small char/varchar fields (note there are no nchar/nvarchar > fields). It also contains a few smalldatetime and decimal(9,2) fields. > There are approximately 24,000 rows. Only managers would be interested in > this plethora of data, but I am in the designing/testing phases and I > wanted > make sure the applications would handle the load under worst case > scenario. > I could probably pare out some of the columns, or create different reports > for different types of customer data, but you know how managers are. In > addition, I have tried smaller sets of data (579 rows)and I still see > symptons of the problem. It seems to me that I could load this dataset, > then > dispose it, and have the memory available for the next run of the report. > By > available I mean available to the application, not necessarily the > operating > system. So maybe I could expect to see the worker process jump up to a > couple hundred MB and stay there for a while, during which time the > memory > would be reserved for subsequent requests. But the memory never gets > released, and subsequent requests consume more and more memory. Are these > assumptions false? If so, why? hmmm - just remembering that adapter.fill opens and closes the connection
for you. :-( so I'm lookingmore closely at your code using (SqlDataAdapter TheAdapter = new SqlDataAdapter("select * from customermaster", DoodConnection)) { using (DataSet TheCustomers = new DataSet()) { TheCustomers.Tables.Add("CustomerMaster"); TheAdapter.Fill(TheCustomers, "CustomerMaster"); TheAdapter.Dispose(); TheCustomers.Dispose(); GC.Collect(); GC.WaitForPendingFinalizers(); } } It's very unkosher. First of all, you do not have to call dispose on the adapter or the dataset. They are managed objects. The issues are around the connection itself - which is calling unmanaged resources.This is why you need to be sure to close connections. Again adapeter.fill will implicitly open and close a connection. The adapter.dispose has nothing at all to do with it. Also. the using stuff is again, to deal with the connection resource issues. In this case it is not really needed for adapter. However, by using the using statement, IT will dispose stuff for you . So by explicitly calling dispose on adapter and dataset, you are calling dispose twice which is unecessary. I don't like the using on the dataadapter and dataset. I'd get rid of them. I would start from more typical code, watch the resources and then if you feel you must do allof that explicit stuff. And I feel the same as Marina about the GC. It is a very complicated beast and there are rare occasions when you would override the default GC behavior. Lastly - when do you do something with the dataset? you fill it then dispose it. Aren't you returning it from here? trial 1 SqlDataAdapter TheAdapter = new SqlDataAdapter("select * from customermaster", DoodConnection) DataSet TheCustomers = new DataSet() TheCustomers.Tables.Add("CustomerMaster"); TheAdapter.Fill(TheCustomers, "CustomerMaster"); trial2 - just explicitly handling the connection using (DoodConnection SqlConnection=new SqlConnection(myconnectionstring)) { SqlDataAdapter TheAdapter = new SqlDataAdapter("select * from customermaster", DoodConnection) DataSet TheCustomers = new DataSet() TheCustomers.Tables.Add("CustomerMaster"); TheAdapter.Fill(TheCustomers, "CustomerMaster"); return TheCustomers; //???? } Show quote "the_chad" <thec***@discussions.microsoft.com> wrote in message news:6CC8BE7F-274C-4180-BB59-8D1D256D679A@microsoft.com... >> but are you closing the connection? > You mean TheAdapter.Dispose() does not take care of this? Do you have to > close the connection for every type of command (select, update, delete) > you > have created with the adapter? Well, I went ahead and tried this but it > did > not help. > >> Hopefully Marina will read the rest... > > Cor, too, I suppose. Thanks!! > > well, looks like Marina and I were typing reponses at the same time. :-) We
are both telling you the same things. Show quote "Julie Lerman" <jlermanATNOSPAMPLEASEthedatafarm.com> wrote in message news:%235fWb71UGHA.5996@TK2MSFTNGP10.phx.gbl... > hmmm - just remembering that adapter.fill opens and closes the connection > for you. :-( > > so I'm lookingmore closely at your code > > using (SqlDataAdapter TheAdapter = new SqlDataAdapter("select * from > customermaster", DoodConnection)) > { > using (DataSet TheCustomers = new DataSet()) > { > TheCustomers.Tables.Add("CustomerMaster"); > TheAdapter.Fill(TheCustomers, "CustomerMaster"); > TheAdapter.Dispose(); > TheCustomers.Dispose(); > GC.Collect(); > GC.WaitForPendingFinalizers(); > } > } > > It's very unkosher. First of all, you do not have to call dispose on the > adapter or the dataset. They are managed objects. The issues are around > the connection itself - which is calling unmanaged resources.This is why > you need to be sure to close connections. Again adapeter.fill will > implicitly open and close a connection. The adapter.dispose has nothing at > all to do with it. > > Also. the using stuff is again, to deal with the connection resource > issues. In this case it is not really needed for adapter. However, by > using the using statement, IT will dispose stuff for you . So by > explicitly calling dispose on adapter and dataset, you are calling dispose > twice which is unecessary. I don't like the using on the dataadapter and > dataset. I'd get rid of them. > > I would start from more typical code, watch the resources and then if you > feel you must do allof that > explicit stuff. And I feel the same as Marina about the GC. It is a very > complicated beast and there are rare occasions when you would override the > default GC behavior. > > Lastly - when do you do something with the dataset? you fill it then > dispose it. Aren't you returning it from here? > > trial 1 > > > SqlDataAdapter TheAdapter = new SqlDataAdapter("select * from > customermaster", > DoodConnection) > DataSet TheCustomers = new DataSet() > TheCustomers.Tables.Add("CustomerMaster"); > TheAdapter.Fill(TheCustomers, "CustomerMaster"); > > trial2 - just explicitly handling the connection > > using (DoodConnection SqlConnection=new SqlConnection(myconnectionstring)) > { > SqlDataAdapter TheAdapter = new SqlDataAdapter("select * from > customermaster", DoodConnection) > DataSet TheCustomers = new DataSet() > TheCustomers.Tables.Add("CustomerMaster"); > TheAdapter.Fill(TheCustomers, "CustomerMaster"); > return TheCustomers; //???? > } > > "the_chad" <thec***@discussions.microsoft.com> wrote in message > news:6CC8BE7F-274C-4180-BB59-8D1D256D679A@microsoft.com... >>> but are you closing the connection? >> You mean TheAdapter.Dispose() does not take care of this? Do you have to >> close the connection for every type of command (select, update, delete) >> you >> have created with the adapter? Well, I went ahead and tried this but it >> did >> not help. >> >>> Hopefully Marina will read the rest... >> >> Cor, too, I suppose. Thanks!! >> >> > > > It's very unkosher. Yes, I know. I have stated that it is just test code - rudimentary at best. I have added the "using" and GC based on suggestions found in other groups. Again, the GC DID help a bit. >First of all, you do not have to call dispose on the adapter or the dataset. They I always call dispose just as a matter of habit. I think that was based on >are managed objects. best practices from the early .net days. > Lastly - when do you do something with the dataset? you fill it then dispose it. Yes, as I said before, this is test code, the dataset is actually used as >Aren't you returning it from here? the source for a report. The report code has been cut out of this segment. I have tested this segment as it appears here and I get the same results, so the memory issue appears to have nothing to do with the report and how it is being managed. The chad,
> 1) You guys and girls need to lighten up. Seriously. Somebody with a normal intelligence would have been so clever that he had made an excuse to Marina and not a sentence like this if he needed help. Cor |
|||||||||||||||||||||||