|
I doubt the memory leak is caused by the declartion of the Exception variable. The exception is generated anyway - it's just not assigned locally.
What are you doing with the message? Probably the leak resides there.
|
|
|
|
|
Vipul Mehta wrote: the reason for not creating Exception classes object is to avoid memory leakage
When an exception is thrown the stack starts to unwind. If you have created any objects that inherit the IDisposable interface then you you need to dispose of them as the stack is unwinding. That is what the finally block is for. Even if you don't catch an exception in a block of code, if it creates a disposable object it should have a finally block.
Dim someObject As SomeObjectClassThatInheritsIDisposable
Try
' Do stuff with someObject
' An exception may be thrown here
End Try
Finally
' Clear up someObject when finished with it.
If Not someObject = Nothing Then
someObject.Dispose()
End If
End Finally
Just remember that the code in the finally block executes regardless of whether the exception was thrown or not. The idea is that this is where you place the clean up code that must be executed in order have disposable objects clean up properly regardless of the state of the system.
Sorry, I'm a C# developer, so my VB.NET may not be totally syntactically correct, but the essence of the idea is exactly the same.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
Hi Friends,
I got a problem Registering the dll in VS 2005 created in VB.NET and i need to use it for the application which is created in VB6. The application currently uses the dll created in VB6 and we need to port it to .NET platform.
So i would like to know,
1. If it can be used by VB6 application?
2. How to register it?
Your Feedback is invaluable for me.
Thanks and Regards,
KEDAR
|
|
|
|
|
I am currently working on a c# app to replace an old Delphi application.
Using IdSMTP.QuickSend() in Delphi I can put any made up address I like for the from field.
Using System.Web.Mail.SmtpMail.Send() in c# the mail will not be sent if the from address is not valid. There is no error returned or exception thrown if the from address does not exist.
Does anyone know why this is or how I can get System.Web.Mail.SmtpMail.Send() to work with from addresses that dont exist.
I realise creating the address on our server is easy and that is what I intend to do but I would like to know why i have to do this and why System.Web.Mail.SmtpMail.Send() does not give any indication that it has failed.
I have taken a vow of poverty. If you want to really piss me off, send me money.
-- modified at 1:14 Monday 16th January, 2006
|
|
|
|
|
|
That is not because of a difference in implementation, but a difference in the SMTP server used. To prevent spam, the SMTP server you are using is set up to only accept existing sender addresses. So, there is nothing that you can do in your code to make the SMTP server accept a non-existing address.
Have you checked the mail folders on the server for rejected mails?
---
b { font-weight: normal; }
|
|
|
|
|
My understanding of email is limited so I may be wrong but I am pretty sure this is not the case. This is our own internal server and I can run the Delphi implementaion of this program which works with the same server and can send email with any from address.
I have taken a vow of poverty. If you want to really piss me off, send me money.
|
|
|
|
|
i think to replacing my data storage (DB) with XML files which each file represent a table in DB and make select and other operations on them.
Is my think right and why?
Thanks for replay!!
|
|
|
|
|
In this case, you are just exposing your data to other user. In terms of security, have you really consider? Besides, it means everytime u have to use dataset to read the xml to filter, and perform database functionality. Would it be efficient ?
|
|
|
|
|
Hard to answer the question without understanding why you would want to do this? XML files are portable and easily readable and editable, but as an operational data store they are not very functional. The issues that I would see with this are:
1) Consistency. With a database system you are guaranteed data is consistent based on the queries run against it, even through a system crash. With XML files, writing to one file may succeed, writing to the next may fail. What state is your data in at that point?
2) Performance. Database systems are optimized for performance, especially query performance. For large data sets a database system is going to be able to query optimally even if the data set it is querying is to big to fit in memory. In order to get any performance out of XML you are probably going to have to load the whole thing into memory, which may be difficult if your data set gets big. XPath is pretty powerful but nobody claims it is a speed burner.
3) Data Relationship Maintenance. If you want to maintain relationships between data tables that are parts of separate documents, each with a separate schema, how are you going to load the relationship information into the DataSet?
4) Query Capability. You will loose significant query capability and performance using your model.
5) Multiuser Capability. Your system of files is a single user solution at best.
If you are building a stand alone, single user application that you expect to have a limited data set size and are dead set on XML files, then I would at least explore putting all the tables into one XML file. Otherwise stick with a database system.
XML files are best used for import and export of data and transfer of data between systems. Granted, XML files are cheap, but MySQL and SQL Server 2005 Express are free as well and much better options for a database engine.
|
|
|
|
|
Hi There,
I have some doubts about dotnet framework. If someone can please clear it.
I have read...
.Net Framework gives advantage of using dotnet application without registering with system registry. This is made possible due to following reasons
.Net can automatically locate referenced assemblies. It contains manifest which has information about assemblies information with other assemblies.
Does it mean that the folder of dotnet application directory has all referenced files. If so then isn't it waste of diskspace if i already have the file in harddisk in someother location.when a dotnet application is copied from one computer to other it copies all the files even though if they are there. Does it finds out before copying the application wheather all refered dll files are there or not?
Thanking you and waiting for some kind replies.
Amit
|
|
|
|
|
There are two options for assembly location in the .net framework. The first of these is the local application directory. As you surmise in your question, if the same assembly were used in multiple applications then it would be on the disk multiple times. It is a waste of disk space, but disk space is relatively cheap and the reality of this happening in practice is pretty small.
For assemblies that are used by multiple applications, like the framework assemblies themselves, you can register them in the Global Assembly Cache (GAC). Assemblies in the GAC are version controlled, so you can have multiple versions of the same assembly being referenced by different applications. According to the theory, this should allow you to upgrade one application and its referenced assemblies without impacting other applications that rely on behaviors of the older versions.
I am responsible for the delivery of a commercial system that has over two dozen assemblies. Many of these assemblies are shared between multiple applications in our system. All of our assemblies are copied locally and total disk space usage is actually minimal and of no concern.
The only time I would expect it to be a concern is on a limited device such as a handheld, but again, the instance of multiply used assemblies outside the system assemblies is minimal. If you have to, put all your executables in the same directory with all your assemblies.
|
|
|
|
|
I am testing out Visual Studio 2005 C# Express Editon and there seems to be errors with updating toolbox controls with proper versioning. It seems like it is caching old versions even though i removed the references from the class and toolbox. If anyone else is having these same issues please post them.
|
|
|
|
|
I want a shared method to be implemented by other business classes. But the problem is in interface class i cannot declare a Shared Method.
Even If I use a base class that is inherited by other business classes, I cannot use Overload or MustOverride against shared functions.
Is there a way out that I can force business classes to implement a shared method.
e.g.
Public Shared Function GetDefaultValue() as String
I am using VB.NET for my business objects that will be used my windows forms.
Ganesh
|
|
|
|
|
Why would you want the method to be static (shared in VB)?
You can't put a static method in an interface, or enforce implementation in inheriting classes, as there is no way of calling that method without specifying the exact class where it's implemented.
So, even if you could force someone to implement a static method, you can't call it. So, what would be the point?
---
b { font-weight: normal; }
|
|
|
|
|
My question is : Is thre any way to pass a remote object as parameter in method call ??
For example:
I have a class library and 2 projects which have references to the class library.
In the class library there's 2 classes both of them inherit from MarshalByRefObject Subject, Observer
In my server project in a form I'm doing
RemotingServices.Marshal(subject, "subject");
In my client I want to do :
Class ConcreteObserver : observer
{
Subject subject = (Authenticator) RemotingServices.Connect(typeof(Subject), URI);
subject.addObservers(this);
}
Is there any way to make this work??? I want to know if it's possible to call a remote object method (in this case addObservers) and pass a remote object in this case a ConcreteObserver.
Thanks very much in advance
|
|
|
|
|
Hi,
We have a Windows service written in .NET 1.1. running on an embedded XP device. It pushes results to a web service every so often.
Today we witnessed for the first time on one of the devices where a dedicated worker thread was running in two instances rather than the in one. As such, a race condition occurred over and over again where the return value obtained from a synchronous web service call in this thread appeared to be erronous (the two racing calls to the web service appear to get their results mixed up).
Although this isn't a show stopper in the code it is really a head scratcher for us. Our code only explicitly creates one worker thread (via the thread class and ThreadStart class). Further, this build of the service has been running for 5 months in production 24/7 on 20 odd devices and it has only shown up this one time (today) on one device
Has anyone experienced a situation where a worker thread gets spwaned multiple times even when it is explicitly only created once? What can I do to prevent this from happening?
Our customer will be asking us for a "root cause" of this problem and I have nothing to offer as an explanation (other than ).
If anyone has any advice to offer then sweet mercy please just someone send me a message.
|
|
|
|
|
Hi All,
I want to convert my .Net 2003 Project to .Net 2005 which is ASP.Net WebService project. Problem is that I don't have .Net 2003 at my home, only I have .Net 2005.
Could you pl help me to convert it in latest version? It's urgent basis.
Thanks.
Hardik Doshi
Software Engineer
-- modified at 1:24 Friday 13th January, 2006
|
|
|
|
|
you don't need vs .net 2003. When opening the Solution-file with vs 2005, the conversion-wizard will guide you through the migration process.
André
'A programmer is just a tool which converts caffeine into code'
|
|
|
|
|
Hi,
I’m working for a company that requires Video conferencing between two employees I’m intending to code this in Managed C++ over a .NET framework. I’m thinking of using windows media player. Therefore, if "A" wants to connect to "B", A would send a Request (opens the connection) and B accepts the request and establishes a connection. I’m currently using Visual Studio C++ Express Edition.
I’ve been researching this like crazy. I would really like some comments/feedback on starting of this project. Any links or advice will be much appreciated!
Many Thanks
hbjs
makaveli
|
|
|
|
|
First of all, I would suggest that any sort of UI development with Express Edition is a PITA. If these people want you to write professional code for them, tell them to buy you a decent IDE.
I would have suggested Direct Show generally for this sort of thing, but it appears to have disappeared. I'm not sure how the WMP control is going to help, does it allow video to be streamed to it ? How are you going to capture the video ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian,
Well I need to develop a prototype of it working for my company. Express isn’t to bad for now.
Well basically there will be a list of names on a database linked with their individual ip address/MAC. When A wants to talk to B, he will select the name. B receives a diologbox asking B is they want to accept. IF they accept, a connection is initiated. Unless you a better suggestion?
WMP do allow videos to be streamed to it, the problem its difficulty actually doing that. It will involve a few encoders. There will be a TCP/IP connection to the full connection. There be UDP from each system. I was also thinking if it will be easier to create a separate screen to pop up only contains the video. What do you think?
I hope I have made it clearer.
Thanks for your help
makaveli
|
|
|
|
|
hbjs wrote: Well I need to develop a prototype of it working for my company. Express isn’t to bad for now.
In that case, have you considered C# Express ? b/c UI with Winforms will be easier in C#, and you don't have MFC in C++ Express.
hbjs wrote: I was also thinking if it will be easier to create a separate screen to pop up only contains the video. What do you think?
No, the WMP control can be quite happily hosted in a form, there's no trouble there.
I'm sorry, I've not done any video capture, so I can't help much beyond that.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Yeh i have to use Managed C++ so I cant use C#.
Thanks for your help and advise!
makaveli
|
|
|
|
|
OK. I'm interested to know why do you have to use managed C++ ( and not MFC, for example ) ? Surely if you're not hired as a developer ( which I assume from you're having to prove yourself before they will provide tools ), they are lucky to get whatever you're willing to work with ?
Christian Graus - Microsoft MVP - C++
|
|
|
|