473,659 Members | 3,117 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1565
Is the System.WeakRefe rence 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*******@cana da.com> schrieb im Newsbeitrag
news:11******** **************@ o13g2000cwo.goo glegroups.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
7006
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, not tuples, so order doesn't matter). There isn't really anything wrong with the solution here, but since Python's for-each construction is so nice, I usually try to avoid range(len(..)) type
5
67671
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 left. The HTML is: <ul> <li><a href="area.html?a=ah">Alexandra Headland</a></li> <li><a href="area.html?a=ca">Caloundra</a></li> <SNIP>
2
2018
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: <http://groups-beta.google.com/group/comp.lang.javascript/browse_frm/thread/aa4a8da635e42592/ba2c264d6a9b3558?q=drag+group:comp.lang.javascript+author:VK&rnum=2&hl=en#ba2c264d6a9b3558> The main issue was to overcome IE's accessibility bug: if user scrolls the list using...
3
1544
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 I read the file
4
2309
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 posting back to the server. How do I implement this? Thanks a lot in advance.
5
34939
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
4974
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 = "Mickey", LastName = "Mouse"}; new {FirstName = "Minnie", LastName = "Mouse"};
10
10497
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 between then what is the best solution.
3
4756
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 are in the result set. It seems easy enough to create my class: public class EntityList<T: List<T> { public int VirtualCount { get; set; } }
4
1449
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 automatically delete those above mention by using some various parameter. So please help me
0
8428
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8851
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8627
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6179
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2752
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1976
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.