473,406 Members | 2,259 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

how to have a list(?) of instances without preventing garbage collection

Dear all,

I create a big number of a class instances of some class. Sometimes this
instances must be collected (all pointers are deleted, but instance is not
explicitly disposed).But sometimes I need to notify all living instances to
reread an init file.

Since I don't want to prevent a garbadge collection of the instances I don't
have an explicit collection of all living instances. So I am trying to use
shared event for notification.

But it seems that event delegate still preventing instances from GC.

Is it possible to somehow notify all living instances of class without
preventing a garbage collection?

Thanks a lot,

Boni
Nov 17 '05 #1
3 1542
Is the System.WeakReference class something you need?
-------------
Thi - http://thith.blogspot.com

Nov 17 '05 #2
You need to search these newsgroups and the web for "weak reference
event handler". There are quite a few sites out there that tell you how
to build them. (Some designs are better than others.)

I had to do this in my system for similar reasons: objects subscribing
to static events that were then held forever because the event chain
held references to them.

Nov 17 '05 #3
Yep,
it is exactely what I need.
But I could not find a way to make a weak shared(static) handlers in .NET
1.1. Is it possible?
Could you point some info? (may be code sniplets or ideas?)

Thanks a lot in advance, Boni

"Bruce Wood" <br*******@canada.com> schrieb im Newsbeitrag
news:11**********************@o13g2000cwo.googlegr oups.com...
You need to search these newsgroups and the web for "weak reference
event handler". There are quite a few sites out there that tell you how
to build them. (Some designs are better than others.)

I had to do this in my system for similar reasons: objects subscribing
to static events that were then held forever because the event chain
held references to them.

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Steven Bethard | last post by:
So I need to do something like: for i in range(len(l)): for j in range(i+1, len(l)): # do something with (l, l) where I get all pairs of items in a list (where I'm thinking of pairs as sets,...
5
by: Howard Martin | last post by:
I have a page at http://www.develop.check.com.au/hols/ where I'm trying to put a navigation strip on the left of the page. Try as I may, I can't get rid of the bullets and move the list over to the...
2
by: VK | last post by:
A while ago there was a discussion how to implement a select list that would call a function right upon new selection is being made w/o clicking any additional buttons: ...
3
by: Gregor Horvath | last post by:
Hi, given the dynamic nature of python I assume that there is an elegant solution for my problem, but I did not manage to find it. I have a file that contains for example on line: when...
4
by: TaeHo Yoo | last post by:
I have two dropdown list(ie State and Region) that are populated with data from database. I want to repopulate the second dropdown list(Region) according to what state user has selected without...
5
by: Steven Baggs | last post by:
Hi!, I have defined a List<T> like this List<Container> Container class holds my Item object and it's state as a Enum. Container.Item Container.State I would like to bind it to GridView.
11
by: pompair | last post by:
Hi, Does anyone know how to use anonymous types in a list? I mean, if you define in your code three anonymous types: new {FirstName = "Donald", LastName = "Duck"}; new {FirstName =...
10
by: Aditya | last post by:
Hi All, I would like to know how it is possible to insert a node in a linked list without using a temp_pointer. If the element is the first element then there is no problem but if it is in...
3
by: daokfella | last post by:
I simply want to extend the List<Tobject to include a property called VirtualCount. Basically, the list will hold my paged records, but the VirtualCount property will tell me how many records total...
4
by: unknown198790 | last post by:
Well in web server there will be many dormant content and inactive account user. These things will just occupy the space. So in order to free up the space i would like to develop a program that will...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.