|
I have found that what takes alot of memory is not the classes you create, but the initial .NET CLR runtime. This means that your apps may have a large initial memory footprint, but unless you do something that normally takes a whole lot of memory, the amount of memory will not increase any faster than a C++ application beyond that.
As for the speed issues, they are because of JIT compilation. If you want to have fast startup times, run ngen.exe on each of the assemblies in your application. This creates a native image of your assembly, so it does not need to be compiled at runtime. Nish and Rama Krishna did a study on the speed of ngen'ed and non-ngen'ed C#, VB.NET, VB, ngen'ed MC++, non-ngen'ed MC++, mixed C++, etc., and they found that C# is not alot slower than C++ once it has been ngen'ed, because there is no longer the overhead of JIT compilation.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
If you display forms using Form.ShowDialog() (shows a modal dialog), you must call Form.Dispose() when you're finished with it. The documentation for Form.ShowDialog() even states this.
Managed application are often bigger memory hogs than their Win32 counterparts, but they can also be faster when managed correctly by your code. Keep in mind that most "windows crashes" are usually actually applications' faults (or users - more often users' faults!). Even though the GC will cleanup memory eventually, you must make sure that all references to an object are disposed. After calling Form.ShowDialog, the form is not disposed until you do so manually. When you start throwing controls and strings in multiple collections, you must make sure than no collections still hold a reference to them. If so, the object still exists on the heap and the GC won't clean it up.
The reason it is sometimes faster even though it is JIT'd (not interpreted like someone said before - I too get deep into the internals of the CLR and IL) is because of improvements in heap and general memory management - that doesn't necessarily mean smaller memory requirements, unfortunately.
I think another reason for large sizes is something I suffer from a lot - overly large assemblies. For instance, in a signed XML app I wrote, I'm forced to use the Microsoft.Web.Services assembly for one class because the System.Cryptography equivalent (using enveloped signatures in this example) doesn't work (at least, not yet). So, the whole Microsoft.Web.Services assembly must be loaded into memory (at least, unlike older implementations of Java, the whole thing isn't JIT'd - just the class I need). This happens quite a bit from what I see. Sometimes making things too easy isn't necessarily a good idea (read "good developers loosing jobs to crappy drag-n-drop VB code monkeys").
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi everybody.
I posted a question here yesterday regarding the intricacies of the ECMA CLI standard, and how to determine the number of bytes you should read for a particular metadata table.
Zoiks, sounds exciting eh? You bet. If anyone has any interest in reading .NET dlls,or any knowledge of Partition 2 of the CLI standards, please check out my question as you may be able to help.
To my shame, I have accidentally cross posted this on the C# board - what a numpty!
Much appreciated, thanks.
Jason King
jason.king@profox.co.uk
Feel the love at www.profox.co.uk
|
|
|
|
|
|
Thanks Leppie. I will take a look. I remember talking to you earlier this year / last year about graphics libraries and the like. Did you get sorted with what you wanted? Maybe we were just nattering and you didn't need anything at all....
Jason King
jason.king@profox.co.uk
Feel the love at www.profox.co.uk
|
|
|
|
|
Hi,
I developed a .net control in XP with .NET framework 1.0.
It works fine when used in XP or Windows 2000, but when I use the application in NT 4.0 service pack 6 with .NET 1.0, it simply fails to load ... i get the message "Unable to load file ‘MyControl.SplitButton’"
MyControl.SplitButton is my assembly - MyControl.SplitButton.dll.
Leave alone not working, NT simply fails to even load the asembly (as per the above message).
Do you think I will need to rebuild the assembly in NT 4.0 (...Windows is really painfull...)
Any thoughts please....
|
|
|
|
|
Hello, I can't seem to find this, but on a Microsoft .net show some time back they showed in passing an example of an assembly being stored on another computer and only parts of it on the computer they were using.
They said that the framework would automatically go to the computer that had the rest of it and bring it over as required.
This got me thinking of all sorts of possibilities, but I can't find any official reference to this and don't know the terminology to search for.
I've been envisioning demo-ing .net apps by providing a minimal download, then as they run it, it gets each piece of the assembly that it needs from our web server to save overall download time.
Is this voodoo thinking?
Can anyone help with the terminology that I should be searching for or a resource on the net that gets into more detail about this?
------------
|
|
|
|
|
|
Ahhh! Perfect!
Obrigado!
------------
|
|
|
|
|
Contente por poder ajudar!
|
|
|
|
|
IIS is hosting those asp.net objects, execute them in its hosted appdomain,
then get their output back to IIS.
For another example, future SQL server will execute a method in compiled .net stored procedure object and get its result back.
Calling method in hosted object is OK, with IDispatch.
But how can we implement the process of getting result back from hosted objects?
|
|
|
|
|
Hi
I need to bind (or dock) a window to the right side of the screen. Also, no other window (from my or another application) show be able to go over it, maximized or not.
How can i do this ?
Thanks
Heelios
|
|
|
|
|
|
I used BitBlt in a c# program
when I set the Form as the Source
a Bitmap as the destination
It works
but when I set Form as th destination
whatever the bitmap is
It just show as black
why?
|
|
|
|
|
I remember when I did some drawing, it came out black if the bitmaps were of incompatible format. (Maybe the form is 256 colours and bitmap is 32bit? Then 256 colours -> 32bit conversion is easy, but 32bit -> 256 is not. I'm not sure if it converts like that, but it's possible)
|
|
|
|
|
The reason for this is stated in this Knowledge Base article[^].
Using GDI on a GDI+ Graphics Object Backed by a Bitmap
When Graphics::GetHDC() is called for a Graphics object that is backed by a bitmap rather than the screen, a memory HDC is created and a new HBITMAP is created and selected into the memory HDC. This new memory bitmap is not initialized with the original bitmap's image but rather with a sentinel pattern, which allows GDI+ to track changes to the bitmap. Any changes that are made to the memory bitmap through the use of GDI code become apparent in changes to the sentinel pattern. When Graphics::ReleaseHDC() is called, those changes are copied back to the original bitmap. Because the memory bitmap is not initialized with the bitmap's image, an HDC that is obtained in this way should be considered "write only" and is therefore not suitable for use with ROPs, the use of which requires the ability to read the target, like R2_XOR. Also, there is a performance cost to this approach because GDI+ must copy the changes back to the original bitmap.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
Hi,
I want to know something about remote installation of a .NET project(C#). I want my setup files(.exe,.msi etc) to reside on the webserver and when a certain user goes to a certain url that points to the location of the installation files, the online installation starts. If ever u would have come across the online installation of yahoo messenger, well that is what i want to achieve. How can that be done. Does .NET provide any means to do this or there is some java script for this? Please tell me step wise.
|
|
|
|
|
Hi
Is it possible to place normal buttons on the main menu in a form?
We have a form with a std. main menu aligned left. Aligned right we would like to have approx. 10 colored buttons.
So the top of the form should look something like this:
---------------------------------------------------
MenuItem1 MenuItem2 Btn1 Btn2 Btn3
---------------------------------------------------
The best option would be if it is possible to limit the width menu in some way (i.e. so it only fills e.g. half of the width of the form).
I know that such a thing can be done with toolbars using panels, but it doesn't seem possible to limit menu width using panels.
Any ideas if this is possible, and how it can be done?
Thanks, Mads
|
|
|
|
|
|
Yes, but how do I rightalign the menuitems that looks like buttons, when the rest of the menuitems (i.e. the standard text ones) are left aligned?
Thanks for your reply.
Mads
|
|
|
|
|
Is there any way to create help files using .net ? Similar like help workshop tool provided in VC++ IDE 6.0?
VikramS
|
|
|
|
|
I don't know Help Workshop tool, but for creating help files .NET you use "HTML Help" 1.3 or 2.
Mads
|
|
|
|
|
Looking for workarounds ...
Tried to set a picture to larger (wider) than Int16 (i.e., 32,767 pixels), via simple assignment. Value is silently truncated to Int16 size, though it's documented as Int32. Why in the world, you might ask, would anyone want a picture box this big? Do I have the best monitor ever? I have a strip chart (a long graph, like an EKG) to display, in a scrolled panel, and it easily overruns the available space.
.NET Framework v1.1, VStudio 2003. It's for sure a bug (I've tested the heck out of it in VC# and VB).
|
|
|
|
|
Size should be Int32, not Int16 (BTW, it may be that the Bitmap truncates it, not the Size struct). However, I think the graph should be kept as numbers, not a bitmap. Re-draw it from the numbers every time the PictureBox is painted.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
Size seems to be masquerading as a System.Int32 struct. Try, in the VS properties, sizing the width of a button to >Int16 (33,000, for example). Boom, silent truncation, utterly undocumented (well, as far as I know; MSDN is *huge*
If I understand your reply correctly, it sounds very like a description of the approach I originally took with this control, before rewriting. I had buttons that did a scroll-left, scroll-right, and so on, and kept track, based on zoom and so on, of what the leftmost and rightmost points had to be, redrawing only that section. The problems with that approach (for me) turned out to be:
1. Speed: I'm writing for a rather slow target platform ...
2. I want to use the built-in scroll bars, rather than rolling my own.
3. I want smooth scrolling (back to number 1 here, no?). I get that from the picture-box, but at the expense of showing only 32767 pixels worth of points.
Thanks,
Ben
|
|
|
|
|