|
-
Jun 20th, 2003, 11:26 AM
#1
Thread Starter
yay gay
.net , collections and memory
i have a struct type called SINGLE_ITEM (just for testing) and a collection of it..i add some SINGLE_ITEMS to my arraylist..and then remove some of them..when i remove them from the list i can still access them if i have other references to it? or they get deleted?
\m/  \m/
-
Jun 20th, 2003, 01:59 PM
#2
Frenzied Member
Once you remove them from the list I dont think you'll be able to access them again.
-
Jun 20th, 2003, 07:01 PM
#3
Thread Starter
yay gay
pseudo code to show a possible situation of what im talkin about:
dim item as new single_item()
dim array as new arraylist()
array.add(item)
array.delete(item)
the 'item' is still alive isnt it?
now if yes as i think it is its ok..but what if its in different subs?
\m/  \m/
-
Jun 20th, 2003, 07:30 PM
#4
Frenzied Member
Ok, in that case item is still accessable. Its just not in the collection any more.
-
Jun 21st, 2003, 08:23 AM
#5
Thread Starter
yay gay
hmm yes but for example in this case?
Code:
IrcUser _tmpUser = ((IrcChannel)_channels[command[2]]).Users[nick];
((IrcChannel)_channels[command[2]]).Users.Remove(nick);
if (UserLeftChannel != null) { UserLeftChannel((IrcChannel)_channels[command2], _tmpUser);
(sorry for being in C#)
\m/  \m/
-
Jun 23rd, 2003, 08:15 AM
#6
Fanatic Member
It should still be accessible -- all of its "roots" aren't gone, and therefore it is not garbage. However, the Remove() function might perform some cleanup on the item that is removed that makes it useless.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|