471,310 Members | 1,058 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,310 software developers and data experts.

EL Caching Block and Dispose

If I place objects into the cached that implement an IDispose, are they
automatically disposed when removed? Looking at the code it doesn't
appear so. How can I handle this? Anyone with a suggestion?

Chris

Jul 27 '05 #1
5 1212
What types of objects you are disposing? Are they holding on to any resouces?

http://msdn.microsoft.com/library/de...izeDispose.asp

You mention something about a code (???) can you post it?

Erick Sgarbi
If I place objects into the cached that implement an IDispose, are
they automatically disposed when removed? Looking at the code it
doesn't appear so. How can I handle this? Anyone with a suggestion?

Chris

Jul 28 '05 #2
In this particular case, I was caching a DataSet. The code I am
referring to is the Enterprise Library source code.

Jul 28 '05 #3
The Dispose method in a dataset will not dispose of any tables or rows (never
touch them). You usually dont need to worry about datasets unless they are
extremelly huge and are being marshalled somewhere. The GC is very efficient
in getting rid of instances that are deferenced from root instances.

HTH,

Erick Sgarbi
www.blog.csharpbox.com
In this particular case, I was caching a DataSet. The code I am
referring to is the Enterprise Library source code.

Jul 28 '05 #4
My concern is not about datasets in particular. I am concerned about
caching any object that requires disposing using the Enterprise
Library. The Tnterprise Library does not seem to call Dispose when an
object that requires it is removed from the cache.

Jul 29 '05 #5
> The Tnterprise Library does not seem to call Dispose when an object that
requires it is removed from the cache.

No need to dispose of your managed objects if they don't use unmanaged resouces.
If they "do" need to be disposed, make sure they implement the dispose pattern
by writting a finalizer... even though finalizers are expensive, you at least
will be certain that "eventually" your unmanaged resources will be freed.
Furthermore, you can always modify or bake your own caching engine.
HTH,

Erick Sgarbi
www.blog.csharpbox.com
My concern is not about datasets in particular. I am concerned about
caching any object that requires disposing using the Enterprise
Library. The Tnterprise Library does not seem to call Dispose when an
object that requires it is removed from the cache.

Jul 29 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Steve W | last post: by
5 posts views Thread by DC Gringo | last post: by
5 posts views Thread by Chris Dunaway | last post: by
5 posts views Thread by michaeltorus | last post: by
1 post views Thread by Ashish | last post: by
8 posts views Thread by Andrew Robinson | last post: by
4 posts views Thread by Hermann | last post: by
5 posts views Thread by =?Utf-8?B?TWFyaw==?= | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.