|
You can check out this article as well:
Implementing IDisposable and the Dispose Pattern Properly[^]
It isn't "mandatory" that you call Dispose in the sense that nothing will force you to include a call to it in your code. The use of IDisposable gives the person using your class an indication that there are unmanaged resources being used and that Dispose should be called when the object is no longer needed. It also allows the object to be wrapped in a using block to help guarantee that Dispose is called.
The pattern is designed for any unmanaged resource, which may or may not include memory. If you forget to call Dispose the GC.SupressFinalaize method also won't be called. If you forget to dispose some unmanaged resources in your Dispose method, then you would have a resource leak, which can potentially be different than a memory leak. (Usually they end up being the same, but not always.)
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
I'm writing a vb.net program that is going to have a huge number of instances of a particular object and I want to figure out how much memmory each instance of this object is going to use. It has no subs or functions nor any subclasses, just variables and arrays. I know how to calculate the memmory usage of the variables and arrays themselves but I was wondering how to calculate the memmory usage for the behind the scenes elements.
I'm guessing that each variable or array has a 4 byte pointer behind the scenes pointing to it and all these pointers are in an array which would add another 4 bytes. Could somebody tell me if this is correct and if not how should I calculate it?
thanks for your help,
Mike
|
|
|
|
|
C# has a sizeof[^] operator that should give you what you want. There is also the Marshal.SizeOf method, but it calculates the size of an object after it's been marshaled to unmanaged code. This size can be different than the managed-code version, which can also be different from a hand-calculated size too.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
thank you for your help.
Mike
|
|
|
|
|
Hi every body,
Can I customize the paper size and print a document directly by coding. And my client have some printed papers, he needs to print the data at required places only. Like "Name : Code Project" here Name : is laready printed and it has to print CodeProject at specified place exactly.
How can we do it please advice me.Thank you.
Regards,
S/W Engineer
Akebono Soft Technologies
aleem_abdul@akebonosoft.com.
|
|
|
|
|
You'll have to explain this a bit more. Are you talking about printing from an ASP.NET app to a printer on the client side??
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Both in Web and windows application, how should I do it. And in web applications server side or even client side. If you can, could you please give me the complete idea or even some code snippet to if possible. Thanks in advance.
Regards,
S/W Engineer
Akebono Soft Technologies
aleem_abdul@akebonosoft.com.
|
|
|
|
|
In an ASP.NET app, you cannot print to a client-side printer. You can serve up the document and maby some client-side Java can do the printing, but it's impossible to do from your ASP.NET code.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Ok. Could you please tell me how to do it for Windows application too. If possible please give me the steps to do it. Or code snippet or provide some links to do it. Thank you.
Regards,
S/W Engineer
Akebono Soft Technologies
aleem_abdul@akebonosoft.com.
|
|
|
|
|
Hi
I m developing a web portal in c# asp.net web application .i want to built an email client using a third party email server e.g, MDeamon.my email client will include the functionalty as
Making new account
sending e mail with attachments
receiving email with inbox maintaing facility. etc
but i have not any idea about it. Can any one guide us first of all about the email server that which server should b used 2ndly how it can be used n from where v can get help regading its builtin methods to b used in email client.
v want help in C# not in HTML codin
Thanx
|
|
|
|
|
Do you mean the email components like CDONTS? or what?
S/W Engineer
Akebono Soft Technologies
aleem_abdul@akebonosoft.com.
|
|
|
|
|
Please don't cross post.
---
Year happy = new Year(2007);
|
|
|
|
|
Did you cross post anything, dont do it. Put it here itself only and wait you will get answer dont worry. Every body is trying to answer you. Thank you.
Ragards,
S/W Engineer
Akebono Soft Technologies
aleem_abdul@akebonosoft.com.
|
|
|
|
|
What happened did you get any answer. And is my answer meeting your requirement. Thank you.
Regards,
S/W Engineer
Akebono Soft Technologies
aleem_abdul@akebonosoft.com.
|
|
|
|
|
i have a service to run against the database. when it is run on my windows 2000 server platform with 2.0 framework , everything runs smoothly. The problem is when i tried to run the same service in a clients computer, it prompts an error as below:[service cannot be started. the handle is invalid] from what i think , the errors gotta do with the permission for the user. can you guys help me sort this out? or at least give me a couple of possibilities what might have occurred ? thanks in advance.. appreciate any helps given
|
|
|
|
|
If you can provide me with more information, I might be able to help...
Is it a smart client app? Or a simple WinForm?
Is the database on the same computer as the client?
Is the database SQL Server 2005? 2000? Access?
I also suggest that you take a look at the exact time when this exception occurs using the debug on a computer with a similar configuration from your client's.
|
|
|
|
|
Hi, I've copied a C# server program straight from another computer to my laptop. Im running on Visual Studio 2005 PE version 8.0. Everything compiles okay and installed perfect. The server program have its own install actions to use in the setup project. Now, assuming I did not touch the code and just for fun, I remove the installaction.dll file from the setup project and then add it again back again and adding it back in the custom action....it still compiles perfect. But this time when it installs, it gives me a "Object reference not set to instance of object" error during installation. Then when installation completes and when I run the server, it gives me problems. So anybody have any ideas why it gives me this problem when I just delete and then add back the dll file without altering it whatsoever? Any suggestion or help will be appreciated.
Please note that I have disconnected myself from the VSS.
~Jacky
|
|
|
|
|
Draqonis wrote: I remove the installaction.dll file from the setup project and then add it again back again and adding it back in the custom action
By removing the file you've probably wiped out some code dependant on it. Just putting the file back won't replace that code. You'll have to see if there's something missing in your project that references that .DLL.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I dont believe any of my code depends installactions.dll file.... I thought the reason it might act like this is maybe because the installactions.dll file was created using an earlier version of .NET and right now Im using the latest version.
|
|
|
|
|
If you install .net 1.1, in your laptop, you will not get any such type of errors...
The same is the case for me...why it happens I dont understand, some backward capability is missing in .Net2.0. I guess???
Regards,
Sunil Jampa
|
|
|
|
|
Hi,
I have a problem when making a report by Crytal report, unfortunately the report has the size of 85cm x 27cm. I have tried but could not make the right one. Could anyone help me in this ? Thanks in advandced.
My email is: wallbio@yahoo.com
WB.
|
|
|
|
|
|
Using ClickOnce? I don't think so. I think you'll have to write your own application that uses the System.Deployment namespace to figure out if various .DLL's in your app need to be updated, downloaded and installed. I have no examples of how to do that. It's never been one of my requirements and I also rarely use ClickOnce.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
|
Richard Hartness wrote: Will future iterations of the .NET platform provide a much more robust form of ClickOnce implementation?
I don't work for MS, so I have no idea.
Richard Hartness wrote: I really like the idea behind it but it seems to be quite simplistic in it's current form.
It's a nice idea, but I haven't been able to delve into it to see if it supports the distribution model you want it to.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|