|
Has a google search brought anything up?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi
I have a large multithreaded Windows Forms application and its leaking GDi objects (VB.Net). The application has a single MDI and multiple forms with multiple tab pages in each form. At any time there is only 1 MDI Child loaded. In the application there are no explicit GDI calls, we do have new fonts getting created but no images etc or any enhanced graphics drawing.
Every time a new form is loaded, the old form is disposed and the contained tab pages are also disposed. We are disposing even the classes. We ran the application with Memory Profiler and have not found any left over objects in the application name space.
Inspite of that the GDI count keeps increasing by ~50 handles every time a new form is opened and closed.
Any help in tracking down the culprit object which is leaking the GDI resources is greatly appreciate.
Thanks
Balakumar
|
|
|
|
|
Balakumar Ponnusamy wrote: we do have new fonts getting created
Do you dispose of them ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi
Thanks for the reply.
We have new fonts created like this in the INITIALIZECOMPONENT section of the New Form.
'
'Label46
'
Me.Label46.Font = New System.Drawing.Font("Tahoma", 8!, System.Drawing.FontStyle.Bold)
Me.Label46.Location = New System.Drawing.Point(840, 51)
Me.Label46.Name = "Label46"
Me.Label46.Size = New System.Drawing.Size(32, 16)
Me.Label46.TabIndex = 40
Me.Label46.Text = "S/L:"
Are we expected to DISPOSE of these Fonts too? It seems counter intuitive, and its strange that if we just use the Microsoft Sans Serif (the default font) no New is added.
Thanks
|
|
|
|
|
Hi,
when you close a form:
1) do you Hide it or Close it?
2) is it actually gone completely, or do you keep some reference to it somewhere,
say in an ArrayList or List so you know which forms are (or have been) open?
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Luc Pattyn wrote: do you Hide it or Close it?
That certainly could be an issue.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
we explicitly close it (no HIDING) since the application is fairly large. We have also used memory profiler to monitor objects creation and destruction, and have found that the objects (ie the ones in the application namespace and to a large extent even in the system and system.windows.forms etc namespace ) are getting garbage collected.
One mistake (according to most of these posts) that we do have in our app is that we are forcing a GC.Collect, but would that cause GDI objects to not get collected?
Thanks
Bala
|
|
|
|
|
Are you running the garbage collector? I would expect that if you create a font object and never dispose of it, the underlying font resource will get released when the object is garbage-collected, but unless you force a garbage collection (generally not a good idea except for diagnostic purposes) that may not happen for awhile.
|
|
|
|
|
supercat9 wrote: the underlying font resource will get released when the object is garbage-collected,
No, it won't. You have to explicitly call Dispose on it to release the unmanaged resources. The GC will not do this for you.
|
|
|
|
|
No, it won't. You have to explicitly call Dispose on it to release the unmanaged resources. The GC will not do this for you.
I would have expected that any of the framework objects that use system resources would have finalize handlers that would free such resources. Obviously if you create your own objects that allocate system resources via API calls you need to free them, but I would expect Microsoft's framework objects should take care of that.
|
|
|
|
|
I have created a setup of a project i did with some new controls. is there anyway to hide the controls from appearing in the programs folder and as such liable to being copied?Thank
av heard of deployment files and resources. what shoukld i do?Thanks
phatkin
|
|
|
|
|
hi prubyholl
its Easy, just go to your Projecty Explorer and right click, select a file system, in the file system view, select the Application Folder and if you see your controls , just right click in them and go to their properties and look for Hidden and select "true", and your controls will be hidden.
Hope this helps
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Thank you very much
phatkin
|
|
|
|
|
hello friends,
if i want to make a setup file in VB.Net 2005 professional what are the steps i have to do for getting the setup file.
|
|
|
|
|
|
thnks friends....
thnks for ur help tonight i'll try it and ask if i have any doubt..
thnks a lot....
|
|
|
|
|
There are wizards built into VS2005 which do this.
|
|
|
|
|
thnks friend,
but will u specify which wizard will do it. bcZ i am new to VB.Net 2005
|
|
|
|
|
hello friends,
i am doing one small project for an company,there they want to store the details of their customer.I finished it.but only thing is in my system i place the Database file in c:\ drive.so,i place the
cn = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\ABS.mdb")
if the company owner wants to change the file location to the current directory means each time he has to change the path or is there any way to tell or define the cuurent directory like VB.
in VB we give &APPPATH& like this any thing in VB.NET.
i am using VB.Net 2005 Professional version.
|
|
|
|
|
I'm not shure but I think you want the 'application.startuppath' this is the location on the hard drive where the exe of the programme is stored
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistakes.
|
|
|
|
|
hai friend,
thnks but now only i am going to try it. after that i'll tell wheather it is working or not.... if it is not working then i'll tell the reason why it is not working.... what u said is crt in our field mistake will lead us to the crt path..
once again i'll thank u...
|
|
|
|
|
Selvakumar A. wrote: in VB we give &APPPATH& like this any thing in VB.NET.
i am using VB.Net 2005 Professional version.
Google it - the first hit gives you an answer
|
|
|
|
|
hai friend,
thnks i got it but now only i am going to try it. after that i'll tell wheather it is working or not....
i think it i'll work....
once again i'll thank u...
|
|
|
|
|
hi
i want bind the values in arry to a listbox like how we are going with dataset
could any one help me for this
with regards
Balagurunathan.B
|
|
|
|
|
Hi,
I am not sure if I got you right, but to bind an array to a listbox you can do the following:
Dim arr() as string = {"A", "B", "C"}
Listbox1.Datasource = arr ' -> A, B, and C will be displayed in three items
Hope this helps
|
|
|
|