Re: SQLDataReader
From: Sahil Malik (contactmethrumyblog_at_nospam.com)
Date: 11/30/04
- Next message: Michael Jackson: "Re: SQLDataReader"
- Previous message: Sahil Malik: "Re: Encrypting/Decrypting Connection String"
- In reply to: Michael Jackson: "Re: SQLDataReader"
- Next in thread: Michael Jackson: "Re: SQLDataReader"
- Reply: Michael Jackson: "Re: SQLDataReader"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 30 Nov 2004 01:14:18 -0500
Michael,
First of all .. I'm glad a pop star of your stature is coding in .NET. ;-).
Secondly - about the dispose - you don't !!! The thing about Dispose is -
it's just as good as the class implemented it. I posted this on my blog a
while back
http://dotnetjunkies.com/WebLog/sahilmalik/archive/2004/11/12/31798.aspx
While that post is mostly about "Connection Pooling" - it does shed some
light on "Why Dispose isn't the magic bullet". (Albeit it's still good, and
you should call it when you can).
The best you can do is to wait until GC kicks in and cleans that up for you.
... while it can be argued that .NET should have given you the ability to
knock out an object if you decided to - that is what you had to do in C++ -
you had to delete for every new you did. And that lead to NOTHING BUT
PROBLEMS !!!. Garbage collector and the non deterministic model is awesome -
even though it is barely 2% shorter of the bestest possible picture - it's
still pretty damn good for no effort on your part.
- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
"Michael Jackson" <stratojack@cox-internet.com> wrote in message
news:10qo3gehbu3e473@corp.supernews.com...
> I've read Dispose, Finalize, etc till I'm blue in the face. How to I
> implement Dispose on a SQLDataReader if it's not in a class?
>
> Michael
>
> "W.G. Ryan eMVP" <WilliamRyan@NoSpam.gmail.com> wrote in message
> news:%234cp7Eq1EHA.412@TK2MSFTNGP14.phx.gbl...
>> NonDeterminstic Finalization.
>> http://discuss.fogcreek.com/joelonsoftware/default.asp?cmd=show&ixPost=6905
>>
>> --
>> W.G. Ryan MVP (Windows Embedded)
>>
>> TiBA Solutions
>> www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
>> "Michael Jackson" <stratojack@cox-internet.com> wrote in message
>> news:10qo18mb5pf49d8@corp.supernews.com...
>>> My application is using the SQLDataReader to retreive and itereate thru
>> rows
>>> of data from SQL Server, then for each row of that SQLDataReader,
>>> selects
>>> related rows from another table via yet another SQLDataReader. When I
>> finish
>>> with a row, I do a SQLDataReader.Close and set it to nothing, but my
>>> .NET
>>> Memory Profiler shows that the instances of the SQLDataReaders are never
>>> being disposed.
>>>
>>> Am I missing something?
>>>
>>> Thanks,
>>> Michael
>>>
>>>
>>
>>
>
>
- Next message: Michael Jackson: "Re: SQLDataReader"
- Previous message: Sahil Malik: "Re: Encrypting/Decrypting Connection String"
- In reply to: Michael Jackson: "Re: SQLDataReader"
- Next in thread: Michael Jackson: "Re: SQLDataReader"
- Reply: Michael Jackson: "Re: SQLDataReader"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|