Has recently been commissioned in the development of third-party commissioning medical infusion system (I took over, the code has been completed, in principle, I only modify the interface part to adapt to our hardware, but the commissioning process, the program itself is exposed to a lot of problems),The system is developed using VB.net, the software's graphical interface is to spend more money n do special art, a large number of maps, is the current mainstream PC machine configuration, it is difficult Shunliu laid down in debug mode.
Problem in two ways, first, a memory leak (I have time to write articles specifically for this purpose), the second, there is GDI leaks.
The first time because of memory leak problem, I always thought the pop-up windows "GDI generic error" is caused due to memory leaks, memory problems can be solved until the program is still running for some time to pop up a similar error.Check a lot of information, find windows task manager to see GDI leaks, as shown (in the View menu, select "Choose Columns" dialog box, gdi objects option)
Found that the program's GDI object count soared, the absence of good tools and methods GDI check (if there is a master in this respect, I hope feel free), so I process large chunks of the code related to GDI shield, and thenthen check whether there are leaks GDI, n repeats, the work pays off, and finally locked the culprit, the relevant code is as follows:
Select Case (uPumpData.PumpName & ""). Trim
Case "******"
IRBDetail.Icon = Icon.FromHandle (CType (ImgTabPage.Images (1), Bitmap). GetHicon)
Case "XXXXXX"
IRBDetail.Icon = Icon.FromHandle (CType (ImgTabPage.Images (0), Bitmap). GetHicon)
Case Else
IRBDetail.Icon = Nothing
End Select