Click here to Skip to main content
15,881,757 members
Home / Discussions / C#
   

C#

 
GeneralRe: Access denied on opening a file for writing Pin
Luc Pattyn15-Oct-09 11:57
sitebuilderLuc Pattyn15-Oct-09 11:57 
GeneralRe: Access denied on opening a file for writing Pin
Member 405249815-Oct-09 21:40
Member 405249815-Oct-09 21:40 
GeneralRe: Access denied on opening a file for writing Pin
Member 405249815-Oct-09 9:21
Member 405249815-Oct-09 9:21 
GeneralRe: Access denied on opening a file for writing Pin
Luc Pattyn15-Oct-09 9:26
sitebuilderLuc Pattyn15-Oct-09 9:26 
QuestionProblems with disposing rescources Pin
Kaare Tragethon15-Oct-09 7:37
Kaare Tragethon15-Oct-09 7:37 
AnswerRe: Problems with disposing rescources Pin
I Believe In GOD15-Oct-09 7:46
I Believe In GOD15-Oct-09 7:46 
GeneralRe: Problems with disposing rescources Pin
Kaare Tragethon15-Oct-09 7:49
Kaare Tragethon15-Oct-09 7:49 
AnswerRe: Problems with disposing rescources Pin
Luc Pattyn15-Oct-09 8:12
sitebuilderLuc Pattyn15-Oct-09 8:12 
Hi,

it is wise to call Dispose() on an object you no longer need, so it can release its unmanaged resources in a deterministic way. However that does not take care of the managed resources, i.e. the object is still alive (as your array is alive and holds a reference to it).

e.g. if each Pinger holds a thread, then that thread (and its stack memory) are still allocated (unless you cleaned them too in Dispose).

so it would also be good to remove the reference from the array as soon as you don't need them.


Kaare Tragethon wrote:
I can clearly see


do you? how? Task Manager is not the right place to get accurate information on this subject. It shows the
working set, not how much memory the app NEEDS.
The differences are:
- the app may need to hold that amount of data;
- or the app may have asked that amount of memory because that was the fastest way to get things done, but in reality lots of memory are unused INSIDE the app (instead of inside the Window memory pool).

Test: minimize your main form. Does that dratically reduce the "memory requirement"? if yes, point proven.

More comments:
- why do you need 254 Pingers all at once? do they really all work in parallel? do you have that many threads?
AFAIK TCP/IP will choke. I tend to use say 8 threads and let each of them ping the addresses one after another (one job list, each thread picks the next job in turn).
- I tend to use a plural noun for a collection, so I would write foreach(Pinger pinger in pingers)...

Smile | :)

Luc Pattyn

I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages

Local announcement (Antwerp region): Lange Wapper? Neen!


GeneralRe: Problems with disposing rescources Pin
Kaare Tragethon15-Oct-09 8:34
Kaare Tragethon15-Oct-09 8:34 
QuestionVariable Get Set Pin
I Believe In GOD15-Oct-09 6:31
I Believe In GOD15-Oct-09 6:31 
AnswerRe: Variable Get Set Pin
EliottA15-Oct-09 6:41
EliottA15-Oct-09 6:41 
GeneralRe: Variable Get Set Pin
I Believe In GOD15-Oct-09 7:42
I Believe In GOD15-Oct-09 7:42 
AnswerRe: Variable Get Set Pin
Henry Minute15-Oct-09 6:55
Henry Minute15-Oct-09 6:55 
GeneralRe: Variable Get Set Pin
I Believe In GOD15-Oct-09 7:40
I Believe In GOD15-Oct-09 7:40 
QuestionCheckBox limiting. [modified] Pin
Gregory Bryant15-Oct-09 5:05
Gregory Bryant15-Oct-09 5:05 
AnswerRe: ControlBox limiting. Pin
Luc Pattyn15-Oct-09 5:13
sitebuilderLuc Pattyn15-Oct-09 5:13 
GeneralRe: ControlBox limiting. Pin
Gregory Bryant15-Oct-09 5:15
Gregory Bryant15-Oct-09 5:15 
GeneralRe: ControlBox limiting. Pin
Saksida Bojan15-Oct-09 6:06
Saksida Bojan15-Oct-09 6:06 
QuestionPassing Label's Name within a Class outside of the Form [modified] Pin
yogi_bear_7915-Oct-09 4:58
yogi_bear_7915-Oct-09 4:58 
AnswerRe: Passing Label's Name within a Class outside of the Form Pin
Luc Pattyn15-Oct-09 5:20
sitebuilderLuc Pattyn15-Oct-09 5:20 
GeneralRe: Passing Label's Name within a Class outside of the Form Pin
yogi_bear_7915-Oct-09 5:47
yogi_bear_7915-Oct-09 5:47 
GeneralRe: Passing Label's Name within a Class outside of the Form Pin
Luc Pattyn15-Oct-09 5:55
sitebuilderLuc Pattyn15-Oct-09 5:55 
GeneralRe: Passing Label's Name within a Class outside of the Form Pin
yogi_bear_7915-Oct-09 6:23
yogi_bear_7915-Oct-09 6:23 
GeneralRe: Passing Label's Name within a Class outside of the Form Pin
Luc Pattyn15-Oct-09 6:56
sitebuilderLuc Pattyn15-Oct-09 6:56 
GeneralRe: Passing Label's Name within a Class outside of the Form Pin
yogi_bear_7915-Oct-09 7:58
yogi_bear_7915-Oct-09 7:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.