|
Taking into account your
1.21 Gigawatts wrote: Vague answers are fine - it's a fairly vague question
the best answer to
1.21 Gigawatts wrote: Am I overlooking something, am I worried too much, or am I just being stupid?
most likely is: yes
|
|
|
|
|
Thanks Luc
I just can't see what it would be!
"If you can't explain it simply, you don't understand it well enough" ~ Albert Einstein
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." ~ Paul Neal "Red" Adair
Now reading: 'The Third Reich', by Michael Burleigh
|
|
|
|
|
your multiple choices aren't mutually exclusive, but I trust you're mostly worrying too much. What's another megabyte?
FYI:
- it all depends on where you look. Task Manager isn't a good place. My big apps typically show both clock time and Environment.WorkingSet in a status bar, updating at 1 Hz.
- a .NET app normally does not return any free memory to Windows; it does when getting minimized though.
- it may depend on Windows version and overall memory usage situation. More recent Windows (Vista, 7) tend to keep memory full of potentially useful data (similar to your app caching something with WeakReferences)
- AFAIK GC.Collect() isn't blocking, it just initiates (or suggests?) a collection. And one of those probably is insufficient to free all dead memory, as there are generations and a finalizer queue. If you must force GC, try a 3-iteration loop with Collect+wait100msec.
- You are aware calling GC.Collect in general isn't a good idea, it messes up the nice Microsoft machinery, well that is what they claim anyway.
|
|
|
|
|
Thanks Luc, that's helpful
Luc Pattyn wrote: - You are aware calling GC.Collect in general isn't a good idea, it messes up the nice Microsoft machinery, well that is what they claim anyway.
I wasn't aware of that, so will take it out.
Trouble with reading stuff on the internet is that a lot of what you read can be contradictory!
Another thing I have found is that it's not so easy to see tell what the developer should be disposing of in the safe way.
But I guess that's down to experience.
Anyway, thanks for the info.
"If you can't explain it simply, you don't understand it well enough" ~ Albert Einstein
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." ~ Paul Neal "Red" Adair
Now reading: 'The Third Reich', by Michael Burleigh
|
|
|
|
|
you're welcome.
see, it pays off not to fish for a vague answer...
this is what I wrote in my animation article: if you need to create some objects (Fonts, Pens, Brushes, ...) either create them inside the Paint handler and don't forget to call Dispose() on them (one must call dispose on instances of a class that offers such method), or better yet create them only once and keep them alive in class members, this avoids creating a lot of new objects, followed by disposing and collecting them.
|
|
|
|
|
1.21 Gigawatts wrote: when looking at the memory usage in the Windows Task Manager
Big mistake. Task Manager show you how much memory the .NET CLR has reserved for you application, not how much it's actually using. Think of the .NET CLR as a virtual machine, a kin to Java. You're seeing the memory that is allocated for the vm, not for what's running inside it.
The .NET CLR maintains a managed memory heap. This is memory that is allocated by Windows and handed to the .NET CLR. The CLR take that memory and allocates everything out of this heap. When your app is done using an object (it goes out of scope), that memory is returned to the managed heap, NOT to Windows. So, according to Task Manager, your app will be "using" 20-30MB of RAM, when it's really only using 10.
Instead of using Task Manager, use Performance Monitor (Start/Run -> Perfmon.msc). You'll find all kind of .NET memory counters you can use to see what your app is really using.
1.21 Gigawatts wrote: I know that you can't determine when garbage collection is done, but I thought that was the purpose of the GC.Collect() method.
No, it doesn't. GC.Collect only suggests that the Garbage Collector be run. It's really a bad idea to do this, unless you really understand why your doing it, how the GC works, and understand the side-effects of running it.
The GC is self-tuning. It watches how your app allocates and frees memory and tunes itself so it doesn't interfere with your app and can keep memory (free and used) organized with future performance in mind, such as allocating future object faster.
|
|
|
|
|
Thanks for responding Dave
Dave Kreskowiak wrote: Instead of using Task Manager, use Performance Monitor (Start/Run -> Perfmon.msc). You'll find all kind of .NET memory counters you can use to see what your app is really using
Ok, I will do that.
I guess I'll go and do some more background reading on how the CLR uses memory - I don't think I understnd it properly enough.
Thanks again, it's much appreciated.
"If you can't explain it simply, you don't understand it well enough" ~ Albert Einstein
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." ~ Paul Neal "Red" Adair
Now reading: 'The Third Reich', by Michael Burleigh
|
|
|
|
|
Excellent information, Dave. Thank you!
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
I need to know whether it is possible to add a datagridview inside a datagridview combobox control.
For reference i am posting a image example which you will get here.If anybody can tell me where I can get the information please let me know.
Thank you.
|
|
|
|
|
Have some Google mojo[^]
You were just asking the wrong question!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks a lot for your help.
|
|
|
|
|
arj_agt wrote: Thanks a lot for your help
Pleasure - I usually get abused for lmgfy responses
I find a major eliminator of questions is the ability to craft a good enquiry on Google. The number of times I have asked the wrong question and been baffled by the lack of response is huge.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I will keep that in mind before posting further.
|
|
|
|
|
I got the idea about multicoulumn combobox but i am having difficulty in implementing it to a datagridviewcombobox. Can anyone help me.
|
|
|
|
|
Like we have FlowLayoutPanel, where controls can automatically get laid out according to their sizes and sequence, I have a requirement of a fluid layout.
In a rectangle or area (say 500w X 100h), there are some fixed small controls. lets say a rectangle control of (100w X 30h) is fixed at point (0 top , 150 left) Now, I need to fill this bigger rectangle with small shaped controls with constant areas but variable widths. Height can be maximum wherever possible.
The controls not adjacent to fixed control will be rectangles So, no problems. The controls adjacent to fixed controls will need to take polygon shape of variable heights to fit in the balance space.
Any logic already existing? Any approaches?
And yes, this is for winforms.
|
|
|
|
|
You ave posted this question in at least FOUR forums, where I suggested you post ONLY in the algorithms forum. Please do not mult-post your question; use one forum and stick to it.
|
|
|
|
|
This question is different from fluid column heights. Its a different approach.
|
|
|
|
|
But I take your point. I may have made a mistake.
|
|
|
|
|
But you also posted this question once already.
|
|
|
|
|
As I said, I may have made a mistake. It was a question with requirement of Algorithm, Windows Form, Layout Managers. and Graphics. I am still learning to learn from CP hence the problem. I will take care in future.
|
|
|
|
|
That is why there is a guideline document like this[^] at the top of each forum, to guide you how to post a question.
[edit]I see from your home page that you have been a CP member for 1 year 9 months; I think you should know the protocols by now![/edit]
|
|
|
|
|
I said I am sorry. Now, can i get some answers?
|
|
|
|
|
On your suggestions, I read the document too.
Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
Now, where does it say? you cannot post at different forums?
My question can have different audiences. I am trying to reach the right kind of people and this can come from various kind of people.
In any case, I am not being rude or anything. I am sorry as i said earlier too. However, I could do with a little less of leg pulling.
|
|
|
|
|
Well I would assume that "Choose the correct forum" means just one. And, as I said you have been a member here for long enough to know the generally accepted protocols.
Som Shekhar wrote: I could do with a little less of leg pulling.
This isn't leg pulling, it's explanation.
|
|
|
|
|
So this keeps happening. I have the standard toolstripcontainer, utilizing multiple toolstrips (toolbars).
Whenever I re-open the form designer, the toolstrips re-arrange themselves and increase the height of the underlying dock panel.
Anyone know how to keep them from rearranging themselves?
|
|
|
|