DIAdem is amassing GDI-Objects

Hi,
I got a problem with a measuring application in DIAdem 8.1.
The application is using a DAC-Block-diagramm for the measuring process. At the end of a measuring cycle the DAC is stopped and a script saves the measured data and restarts the blockdiagramm for the next measuring cylce. The script also creates a picture, using picload/picupdate/picexport, with the name and some general data that is displayed in the block diagramm. Each time the appliaction restarts the GDI-Objects used by DIAdem grow by 2. The memory used by DIAdem will also grow. This growth is constant and since the application is running constantly it will lead to a crash at some point.
The memory is only released when DIAdem is closed.
This problem is occurs on 2 different computers, one running windows 2000 and one running windows xp. The program communicates with the outside world via opc and dde, but removing those blocks wont fix the leak.

Hi Walter,
thanks for the reply. I did install the latest application SP, but not the driver. Although I am not 100% sure it was the latest SP, I will check that tomorrow when I am back at the company.
The application gets the data from the measuring system via an Profibus-Server (OPC-Protocol). The measuring hardware isnt on the computer running DIAdem. The problem does also occur with simulated signals. I removed the OPC-In and Outputs to test the software on another pc and I got the same problem on that one.
I dont reload the DAC-Scheme, I just do a schemecheck every cylce. I did test reloading it though and it didnt help.
I did some further testing and the problem seems to be connected to saving the picture with picexport. Every time I call that function the gdi-objects raise by 2 (the displayed value changes but the maximum value raises by 2). The same happens when I use picprint as an alternative. I also tried various combinations with and without picdelete, picload or picupdate but only not saving the picture seems to stop the problem.
The picture itself is made up of static text and 5 variables that describe the current measured item (3 Strings and 2 Reals). 
Right now I am running a test version where I use buttons to display the data and its been stable for about 2 days now.
I hope that helps tracking the problem down.
Best regards
Utz

Similar Messages

  • CrystalReportViewer 2008 does not release GDI objects after closing.

    We need help in resolving an issue with a WinForms application we have developed that makes use of the Crystal Reports 2008 viewer control to both generate reports based on various parameters the user supplies and to view these same reports having been previously saved in crystal 2008 format.
    The issue we are seeing is that GDI objects are being created during the report generation process but some are not being released when the report viewer window is closed down. This leads to the system running out of GDI objects (seen by using the Windows task manager) and ultimately the application crashes. It is only when the application is closed completely that GDI resources are returned to the system.
    In an effort to isolate the cause of this problem we created a much simplified WinForms application that simply allowed us to systematically open and close a WinForm  that contains a CrystalReportViewer  to display one of our example reports. We found that the behaviour is the same for this application too.
    Browsing the crystal reports forums reveals there have been a few questions about u201Cmemory leaksu201D like this (see "Thread: CrystalReportViewer memory usage increases until out of memory" as an example) and there has been a good deal of talk about manually "disposing" of report documents and viewers but trying this does not correct this issue
    The extent of the "GDI Object leak" does depend upon the kind of report that is pulled in. One report we have that is 360 pages long and contains graphs and tables of data leaks 390 object per test iteration.
    Is this a known issue with the Crystal Report Viewer and if so is there an update or a workaround available?
    Are we performing all the correct initialisation prior to using the viewer? For example we are supplying the report to the viewer through a ReportDocument object; is there something special we need to do with that?
    Do we have to do anything special when closing the viewer?
    Could it be to do with the design of our reports? We are using the Crystal Reports 2008 editor (sp1) to do this design.
    We urgently need to help in understanding why this is happening and to be able implement a solution that will address this problem.
    I have provided the following code snippets of this sample application to give a flavour of what we are doing and hopefully you can see that it is not complex. The example shows the crystal viewer being presented with a ReportDocument as a Report Source ... this is how our proper application does things but if you try supplying the filename of the crystal report directly, the problem is the same.
    This C# code was written using Visual Studio 2008.
    // ===================================================================================
    //                                                  Sample Code Snippets  
    // ===================================================================================
        static class Program
            /// <summary>
            /// The main entry point for the application.
            /// </summary>
            [STAThread]
            static void Main()
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new MDIParent1());
    // ===================================================================================
    // ===================================================================================
        public partial class MDIParent1 : Form
            private int childFormNumber = 0;
            public MDIParent1()
                InitializeComponent();
            private void ShowNewForm(object sender, EventArgs e)
                Form childForm = new TestForm();
                childForm.MdiParent = this;
                childForm.Text = "Window " + childFormNumber++;
                childForm.Show();
            private void OpenFile(object sender, EventArgs e)
                OpenFileDialog openFileDialog = new OpenFileDialog();
                openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
                openFileDialog.Filter = "Text Files (.txt)|.txt|All Files (.)|.";
                if (openFileDialog.ShowDialog(this) == DialogResult.OK)
                    string FileName = openFileDialog.FileName;
            private void SaveAsToolStripMenuItem_Click(object sender, EventArgs e)
                SaveFileDialog saveFileDialog = new SaveFileDialog();
                saveFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
                saveFileDialog.Filter = "Text Files (.txt)|.txt|All Files (.)|.";
                if (saveFileDialog.ShowDialog(this) == DialogResult.OK)
                    string FileName = saveFileDialog.FileName;
            private void ExitToolsStripMenuItem_Click(object sender, EventArgs e)
                this.Close();
            private void CutToolStripMenuItem_Click(object sender, EventArgs e)
            private void CopyToolStripMenuItem_Click(object sender, EventArgs e)
            private void PasteToolStripMenuItem_Click(object sender, EventArgs e)
            private void ToolBarToolStripMenuItem_Click(object sender, EventArgs e)
                toolStrip.Visible = toolBarToolStripMenuItem.Checked;
            private void StatusBarToolStripMenuItem_Click(object sender, EventArgs e)
                statusStrip.Visible = statusBarToolStripMenuItem.Checked;
            private void CascadeToolStripMenuItem_Click(object sender, EventArgs e)
                LayoutMdi(MdiLayout.Cascade);
            private void TileVerticalToolStripMenuItem_Click(object sender, EventArgs e)
                LayoutMdi(MdiLayout.TileVertical);
            private void TileHorizontalToolStripMenuItem_Click(object sender, EventArgs e)
                LayoutMdi(MdiLayout.TileHorizontal);
            private void ArrangeIconsToolStripMenuItem_Click(object sender, EventArgs e)
                LayoutMdi(MdiLayout.ArrangeIcons);
            private void CloseAllToolStripMenuItem_Click(object sender, EventArgs e)
                foreach (Form childForm in MdiChildren)
                    childForm.Close();
    // ===================================================================================
    // ===================================================================================
        public partial class TestForm : Form
            private ReportDocument crDocument;
            public TestForm()
                InitializeComponent();
            private void TestForm_Load(object sender, EventArgs e)
                crDocument = new ReportDocument();
                crDocument.Load(@"C:\Reports\Sample1.rpt");
                this.crystalReportViewer1.ReportSource = crDocument;
    //            this.crystalReportViewer1.ReportSource = @"C:\Reports\Sample1.rpt";
            private void TestForm_FormClosing(object sender, FormClosingEventArgs e)
                this.crDocument.Dispose();
    // ===================================================================================

    Hi Martyn,
    I tested this and found after using this code to re-initialize the report viewer there we still 400 GDI objects not getting released. This may or may not be a CR issue. Still testing.
    Try this also, I simply created a close button but you should be able to do this in your form close method also depending on how you do it:
            private void CloseReport_Click(object sender, EventArgs e)
                rptClientDoc.Close();
                crystalReportViewer1.Dispose();
                GC.Collect();
                this.crystalReportViewer1 = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
                InitializeComponent();
                crystalReportViewer1.ShowExportButton = true;
                crystalReportViewer1.EnableRefresh = true;
                crystalReportViewer1.Controls.Count.ToString();
                crystalReportViewer1.BackColor.IsNamedColor.ToString();
                crystalReportViewer1.EnableToolTips = true;
                crystalReportViewer1.Refresh();
    The issue has now been tracked - Problem_Report:  ADAPT01301248
    Thanks again
    Don
    Edited by: Don Williams on Sep 15, 2009 11:01 AM

  • GDI object leak using an applet with Java Plugin 1.4.2_02

    We have an application where we use an applet to draw some graphs. The applet has an interface to update the graphical data using Javascripts. Now duing every graphical update of the graph there a leak of the GDI objects. Over time the display on the machine gets frozen due to lack of resources.
    This problem is happening with IE 6.0 using Sun Java Plug-in 1.4.2_02.
    Has anybody else seen this problem. Is there any work aorund for this issue.

    The code is not leaking. This has been verified.
    The problem has been fixed in 1.5.0 (5.0) Beta 2 version but I don't know then final release of this is going to be. Also using a beta version now is not an option.
    The 1.4.2_04 did not fix the GDI leak that I am seeing, I was hoping it would.

  • 9879: GDI Objects resource leak in explorer.exe (directly affects Taskbar)

    Update 1 (Nov 18): The leak seems to be exacerbated by the use of a progress bar within a given program's taskbar icon. For example, downloads with a browser show such status. In particular, media players often do this too, and since people
    tend to use media players for an hour or two at a time, the problem can worsen quickly when in use.
    ===========(Original message below)
    Twice in one day I've seen GDI Objects (as shown in Task Manager--if you add the column on the Details tab--and Process Explorer) hit 10K for Explorer.exe. The first time was after about 15 hours, the second time about 4.
    What caused me to look was a misbehaving taskbar: icons for some running programs were suddenly either blank or changed, some would do nothing when clicked, the Start menu was barely functional, my quicklaunch shortcut menu didn't work, etc.
    Killing explorer.exe and restarting it allows you to proceed as usual.
    This definitely didn't happen in the preceding builds.
    Further details provided if this turns out to be something that others see.

    Same for PS
    GDIView.ps1
    $path = Split-Path -parent $MyInvocation.MyCommand.Definition
    $searchfor = "explorer"
    $maxGDI = 6000
    $sig = @'
    [DllImport("User32.dll")]
    public static extern int GetGuiResources(IntPtr hProcess, int uiFlags);
    Add-Type -MemberDefinition $sig -name NativeMethods -namespace Win32
    $processes = [System.Diagnostics.Process]::GetProcesses()
    ForEach ($p in $processes)
    # Check for process
    if ($p.Name -ne $searchfor) { continue }
    try{
    $gdiHandles = [Win32.NativeMethods]::GetGuiResources($p.Handle, 0)
    # Check for maxGDI
    if ($gdiHandles -lt $maxGDI) { continue }
    try{
    # Log
    "$(Get-Date) The process $searchfor ($($p.id)) had $gdiHandles GDI Objects, so it is closed for sanity" | Out-File $path\Leak.log -Append
    #Write-Output "kill $($p.Id)"
    kill $p.Id -Force
    #Write-Output "start $searchfor"
    Start-Process $searchfor
    catch {
    #"Error"
    catch {
    #"Error accessing " + $p.Name
    And to start it hidden
    GDIView.vbs
    Const HIDDEN_WINDOW = 0
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set objStartup = objWMIService.Get("Win32_ProcessStartup")
    Set objConfig = objStartup.SpawnInstance_
    objConfig.ShowWindow = HIDDEN_WINDOW
    Set objProcess = GetObject("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process")
    objProcess.Create "powershell -file GDIView.ps1", null, objConfig, intProcessID

  • Applet using JVM 1.5.0_06 causes GDI Object Leaks

    Hi,
    Since the release of 1.5.0_06 our applet has developed a GDI Object leak. Basically, our applet draws on a panel when ever an update is available. The previous versions of the JVM seem fine and th e GDI Objects are stable, but this new version eats the GDIs up really quickly, and never releases them.
    The problem occurs when the applet repaints itself. Calling repaint() or paint() from code works ok with no leaks but as soon as the applet is forced to repaint because of a resize, or because another window has moved over it the GDIs go up by multiples of 10.
    Here is some sample code:
    import java.awt.*;
    import java.applet.*;
    import java.util.Date;
    * <p>Copyright: Copyright (c) 2005</p>
    * <p>Company: </p>
    * @author not attributable
    * @version 1.0
    public class GDIApplet extends Applet {
        //Construct the applet
        public GDIApplet() {
        //Initialize the applet
        public void init() {
            try {
                jbInit();
            } catch (Exception e) {
                e.printStackTrace();
        //Component initialization
         private void jbInit() throws Exception {
             this.setLayout(new BorderLayout());
             this.add(new GDIPanel(), BorderLayout.CENTER);
         public class GDIPanel extends Panel implements Runnable{
        public GDIPanel() {
            Thread t = new Thread(this,"SPGPaintTimer");
            t.start();
        public void paint(Graphics g){
            if( g == null){
                return;
            System.out.println("Paint on thread: " + Thread.currentThread().getName());
            Date d = new Date();
            Rectangle bounds = getBounds();
            g.setColor(Color.black);
            g.fillRect(0,0, bounds.width, bounds.height);
            FontMetrics fm = g.getFontMetrics();
            String val = d.toString();
            int width = fm.stringWidth(val);
            int height = fm.getHeight();
            int x = (bounds.width - width) /2;
            int y = (bounds.height/2) - height;
            g.setColor(Color.yellow);
            g.drawString(val,x,y);
        public void run(){
            while(true){
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException ex) {
                repaint();
    }

    Hi there.
    I've found this page by googling.
    I am not a Java developer, but am using a third party java applet on my web page for mapping.
    Funnily enough, I've been trying to hunt down a memory leak thats occuring in IE (not any other browser).
    It only occurs when the applet is physically visible on the page, and the user is using the Sun JVM (1.5.0_06). The GDI object count increases every time I mouseover a link in a tree.
    This does not occur with the MS JVM.
    Unfortunately I do not have access to the applet source code, but I'm wondering if its related to your problem.
    Have you had any success on this?
    Thanks.

  • Performance and Sprite objects

    I've written an application in Flex 2 that consists of
    several accordions containing custom canvas objects, and it is
    having performance problems.
    I'm running the application within IE 6.0 under Windows 2000.
    The application loads an XML file and uses the data to create
    custom Sprite objects in the canvases. Each Sprite consists of two
    swf images that are loaded using the Loader class, a small
    rectangle created by using the Sprite graphics property, and a text
    label. In addition, each Sprite is connected to one or more other
    Sprites by a line drawn using the Sprite's graphics property. The
    Sprites have the capability for being dragged, and for being
    highlighted when clicked.
    My problem is performance; these Sprites perform slower than
    a similiar program that I wrote in ActionScript 2.0. From what I
    understand, Flex 2.0, ActionScript 3.0, Flash 9, and the new Sprite
    class are supposed to deliver greatly improved performance, but my
    new application seems worse than the old one under Flash 7 using
    MovieClips. The more Sprites on the screen, the worse the
    performance, and the lines seem to contribute to the degradation.
    There is way too much code involved to include in this
    message, so I'm looking for general info. Is there some basic point
    I am missing?
    The performance is also degraded when triggering instances of
    the Menu and Popup classes. When running the Task Manager during
    the application, I've noticed that both Memory Usage and GDI
    objects increase whenever I display a Menu or Popup. Both Memory
    Usage and GDI objects go up and down, but there is a steady
    increase in both metrics as I continue to use Menus and Popups. As
    far as I can tell, I am disposing of both types of objects
    properly, but it appears that their allocation is remaining in
    memory.

    I've written an application in Flex 2 that consists of
    several accordions containing custom canvas objects, and it is
    having performance problems.
    I'm running the application within IE 6.0 under Windows 2000.
    The application loads an XML file and uses the data to create
    custom Sprite objects in the canvases. Each Sprite consists of two
    swf images that are loaded using the Loader class, a small
    rectangle created by using the Sprite graphics property, and a text
    label. In addition, each Sprite is connected to one or more other
    Sprites by a line drawn using the Sprite's graphics property. The
    Sprites have the capability for being dragged, and for being
    highlighted when clicked.
    My problem is performance; these Sprites perform slower than
    a similiar program that I wrote in ActionScript 2.0. From what I
    understand, Flex 2.0, ActionScript 3.0, Flash 9, and the new Sprite
    class are supposed to deliver greatly improved performance, but my
    new application seems worse than the old one under Flash 7 using
    MovieClips. The more Sprites on the screen, the worse the
    performance, and the lines seem to contribute to the degradation.
    There is way too much code involved to include in this
    message, so I'm looking for general info. Is there some basic point
    I am missing?
    The performance is also degraded when triggering instances of
    the Menu and Popup classes. When running the Task Manager during
    the application, I've noticed that both Memory Usage and GDI
    objects increase whenever I display a Menu or Popup. Both Memory
    Usage and GDI objects go up and down, but there is a steady
    increase in both metrics as I continue to use Menus and Popups. As
    far as I can tell, I am disposing of both types of objects
    properly, but it appears that their allocation is remaining in
    memory.

  • Diadem file (image) to database

    Greetings all,
    Recently we've found a problem with our application. Instead of exporting report images to a network unit we'll have to save them in a database.
    Until now, we saved them to a network drive without any problem. We're able to access our database and insert text values from the application, but now we need to save files (images). This is where things become complicated. DIAdem offers a textStream object, but not a inputstream that allows to read a byte array...
    So, anyone had a problem like this and found a solution? I've found some samples of something similar on NI site, but all of them are for labview...
    Any help is greatly appreciated,
    Tomas
    Solved!
    Go to Solution.

    Sub Base64StringToFile(ByRef vCode, ByVal fullFilePath)
    if FileExist(fullFilePath) then
    FileDelete(fullFilePath)
    end if
    Dim oXML : Set oXML = CreateObject("Msxml2.DOMDocument.3.0")
    dim oNode : Set oNode = oXML.CreateElement("base64")
    oNode.dataType = "bin.base64"
    oNode.text = vCode
    Dim BinaryStream : Set BinaryStream = CreateObject("ADODB.Stream")
    BinaryStream.Type = 1
    BinaryStream.Open
    BinaryStream.Write oNode.nodeTypedValue
    BinaryStream.SaveToFile fullFilePath
    Set BinaryStream = Nothing
    Set oNode = Nothing
    Set oXML = Nothing
    End Sub
    Sub Base64FileToString(ByVal fullFilePath, ByRef vCode)
    Dim BinaryStream : Set BinaryStream = CreateObject("ADODB.Stream")
    BinaryStream.Type = 1
    BinaryStream.Open
    BinaryStream.LoadFromFile(fullFilePath)
    Dim oXML : Set oXML = CreateObject("Msxml2.DOMDocument.3.0")
    dim oNode : Set oNode = oXML.CreateElement("base64")
    oNode.dataType = "bin.base64"
    oNode.nodeTypedValue = BinaryStream.Read()
    vCode = oNode.text
    End Sub
     I used those two methods to read binary file and put it into base64 string. Maybe this helps.

  • Adobe Reader X leaks GDI handles in quick search box

    Just installed Adobe Reader X a couple of days ago (Windows 7, x64). I used it for numerous online documents (in Firefox), while searching for some specific terms in each document. After a while the reader presented a strange picture, not properly painting itself anymore. Then, the reader became unresponsive, and Firefox too, and I had to kill the task.
    This happened a few times on different pdf documents.
    In my programming career things like these have happened more often so, when the behavior happened again, I went checking the process using Windows Task Manager, adding a few extra columns (Handles, User Objects, GDI Objects) and found that the number of GDI objects was nearly 10000, the absolute limit that Windows imposes on any single process.
    I went on checking the reader, now standalone and without Firefox, to see if the problem would persist. Opened a few pdfs and scrolled back and forth. No problems -
    tried the same in Firefox to see if the plugin was OK - still no problem.
    Then started using the quick search box (Ctrl-F) and repeatedly looked for something trivial (e.g. just a single letter A) - Bingo! Now the GDI handle count starts rising seriously, and does not come back to the original level.
    This is definitely a leak, and it needs to be fixed.

    We don't process bug reports via these forums - please post any details of unexpected behaviors to the official reporting form.

  • GDI Resources?

    I have had many problems using Captivate 1.0 to capture
    screen srecordings from my CAD application. I have spoken to the
    developers of the CAD program and they put it down to GDI
    resources. They told me to enable GDI resources in the columns of
    my Task Manager (right click) and check the amount of GDI resources
    being used. My CAD application maxes out at about 2375 GDI Objects,
    while Captivate 1.0 uses about 673 GDI Objects.
    Does anyone know if this is excessive? Apparently this is not
    dependent on hardware, but I don't know enough about it to be sure.
    The reason why I am asking is because whenever I drag a dialog,
    during a screen recording, Captivate shows remnants of everywhere
    my dialog box has been dragged and there's no way of getting rid of
    it. It's a very serious matter that may unfortunately prevent me
    from using the software entirely. Maybe Captivate has a resource
    leak? Maybe Captivate 2.0 solves the problem? Maybe there is a
    setting somewhere that solves it?
    In any case, I would like to hear from anyone who may be able
    to shed some light on the subject, or even solve the problem! I
    really want to use Captivate - and preferably without editing
    images to remove my dialog remnants.
    Thanks in advance,
    spritc.

    Have you adjusted the Video Acceleration option at all?
    Display Properties > Settings > Advanced >
    Troubleshoot.
    Knock that slider down a notch and try again. If no luck,
    down another
    notch and try again...until there are no more notches to try
    or the
    recording improves.
    If you can't get a decent result, perhaps try Camtasia. It's
    pretty good
    at these full-motion recordings...as that's how it captures
    the entire
    process (as a movie, not as screenshots like Captivate does).
    However,
    that can also result in pretty sizable output files. Camtasia
    automatically disables the screen acceleration (if so
    enabled), so maybe
    the same principle will work with Captivate.
    As a workaround idea for such things, do you actually have to
    show the
    window dragging? It's a pretty easy concept. Could you not
    say, "Now I'm
    going to move this window to the side..." and show your mouse
    moving to
    the window, then erase the 'wacky' frames with trails so the
    next frame
    is the window in the new location. It may be a bit...dramatic
    of a move
    but would it really hurt the instruction? I'd think only
    perhaps if the
    point of the instruction was to show users how to move
    windows...
    Also, maybe check out Display Properties > Appearance >
    Effects. If
    nothing else, perhaps unchecking 'show window contents while
    dragging'
    will solve the problem by showing the window outline during
    the drag,
    which should be a lot less 'GDI' intensive.
    Erik
    spritc wrote:
    > I have had many problems using Captivate 1.0 to capture
    screen srecordings from
    > my CAD application. I have spoken to the developers of
    the CAD program and they
    > put it down to GDI resources. They told me to enable GDI
    resources in the
    > columns of my Task Manager (right click) and check the
    amount of GDI resources
    > being used. My CAD application maxes out at about 2375
    GDI Objects, while
    > Captivate 1.0 uses about 673 GDI Objects.
    >
    > Does anyone know if this is excessive? Apparently this
    is not dependent on
    > hardware, but I don't know enough about it to be sure.
    The reason why I am
    > asking is because whenever I drag a dialog, during a
    screen recording,
    > Captivate shows remnants of everywhere my dialog box has
    been dragged and
    > there's no way of getting rid of it. It's a very serious
    matter that may
    > unfortunately prevent me from using the software
    entirely. Maybe Captivate has
    > a resource leak? Maybe Captivate 2.0 solves the problem?
    Maybe there is a
    > setting somewhere that solves it?
    >
    > In any case, I would like to hear from anyone who may be
    able to shed some
    > light on the subject, or even solve the problem! I
    really want to use Captivate
    > - and preferably without editing images to remove my
    dialog remnants.
    >
    > Thanks in advance,
    > spritc.
    >
    Erik Lord
    http://www.capemedia.net
    Adobe Community Expert - Authorware
    http://www.adobe.com/communities/experts/
    http://www.awaretips.net -
    samples, tips, products, faqs, and links!
    *Search the A'ware newsgroup archives*
    http://groups.google.com/group/macromedia.authorware

  • Applet causes GDI Leak using 1.5.0_06 only

    Hi,
    Since the release of 1.5.0_06 our applet has developed a GDI Object leak. Basically, our applet draws on a panel when ever an update is available. The previous versions of the JVM seem fine and th e GDI Objects are stable, but this new version eats the GDIs up really quickly, and never releases them.
    The problem occurs when the applet repaints itself. Calling repaint() or paint() from code works ok with no leaks but as soon as the applet is forced to repaint because of a resize, or because another window has moved over it the GDIs go up by multiples of 10.
    Here is some sample code:
    import java.awt.*;
    import java.applet.*;
    import java.util.Date;
    public class GDIApplet extends Applet {
        //Construct the applet
        public GDIApplet() {
        //Initialize the applet
        public void init() {
            try {
                jbInit();
            } catch (Exception e) {
                e.printStackTrace();
        //Component initialization
         private void jbInit() throws Exception {
             this.setLayout(new BorderLayout());
             this.add(new GDIPanel(), BorderLayout.CENTER);
         public class GDIPanel extends Panel implements Runnable{
        public GDIPanel() {
            Thread t = new Thread(this,"SPGPaintTimer");
            t.start();
        public void paint(Graphics g){
            if( g == null){
                return;
            System.out.println("Paint on thread: " + Thread.currentThread().getName());
            Date d = new Date();
            Rectangle bounds = getBounds();
            g.setColor(Color.black);
            g.fillRect(0,0, bounds.width, bounds.height);
            FontMetrics fm = g.getFontMetrics();
            String val = d.toString();
            int width = fm.stringWidth(val);
            int height = fm.getHeight();
            int x = (bounds.width - width) /2;
            int y = (bounds.height/2) - height;
            g.setColor(Color.yellow);
            g.drawString(val,x,y);
        public void run(){
            while(true){
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException ex) {
                repaint();
    }

    could you please file a bug-repor at bugs.sun.com - this would ensure that java-developers are looking into this issue.
    lg Clemens

  • Printing causes gdi leakage?

    Hi!
    I have a problem when printing a lot of reports to the printer. I'm using java 1.5.0
    running under Windows2003. I set up a nul printer (or pause my default printer)and run the
    code below, and watch the gdi objects count (via Taskmanager) increase and increase and...
    When it reaches 10000 the desktop will be messed up and my app stops printing.
    How do I end a printerjob to avoid this????
    Any help is appreciated,
    Regards
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.print.PageFormat;
    import java.awt.print.Printable;
    import java.awt.print.PrinterException;
    import java.awt.print.PrinterJob;
    import javax.swing.JFrame;
    * @author janne
    * To change the template for this generated type comment go to
    * Window>Preferences>Java>Code Generation>Code and Comments
    public class PTest extends JFrame implements Printable
         class TestPrn extends Thread
              public boolean stop = false;
              private PTest frame;
              public TestPrn(PTest frame)
                   this.frame = frame;
              public void stopMe()
                   stop = true;
              public void run()
                   while (!stop)
                        PrinterJob printerJob = PrinterJob.getPrinterJob();
                        printerJob.setPrintable(new PTest());
                        try
                             printerJob.print();
                        catch (Exception e)
                        try
                             Thread.sleep(1000);
                        catch (Exception e)
         private TestPrn pt;
         private javax.swing.JPanel jContentPane = null;
         private javax.swing.JButton jButton = null;
         static public PTest o = null;
         private javax.swing.JButton jButton1 = null;
          * This is the default constructor
         public PTest()
              super();
              initialize();
          * This method initializes this
          * @return void
         private void initialize()
              this.setSize(300, 200);
              this.setContentPane(getJContentPane());
              this.setTitle("PTest");
              this.addWindowListener(new java.awt.event.WindowAdapter()
                   public void windowClosing(java.awt.event.WindowEvent e)
                        System.exit(0);
          * This method initializes jContentPane
          * @return javax.swing.JPanel
         private javax.swing.JPanel getJContentPane()
              if (jContentPane == null)
                   jContentPane = new javax.swing.JPanel();
                   jContentPane.setLayout(new java.awt.BorderLayout());
                   jContentPane.add(getJButton(), java.awt.BorderLayout.SOUTH);
                   jContentPane.add(getJButton1(), java.awt.BorderLayout.CENTER);
              return jContentPane;
          * This method initializes jButton
          * @return javax.swing.JButton
         private javax.swing.JButton getJButton()
              if (jButton == null)
                   jButton = new javax.swing.JButton();
                   jButton.setText("Start");
                   jButton.addActionListener(new java.awt.event.ActionListener()
                        public void actionPerformed(java.awt.event.ActionEvent e)
                             pt = o.new TestPrn(o);
                             pt.start();
              return jButton;
         /* (non-Javadoc)
          * @see java.awt.print.Printable#print(java.awt.Graphics, java.awt.print.PageFormat, int)
         public int print(Graphics graphics, PageFormat format, int pageIndex) throws PrinterException
              System.out.println("In print");
              /* We'll assume that Jav2D is available.
              //          Graphics2D g2d = (Graphics2D) graphics;
              /* Move the origin from the corner of the Paper to the corner
               * of the imageable area.
              //          g2d.translate(format.getImageableX(), format.getImageableY());
              //          g2d.draw3DRect(10,10,100,500,true);
              //          return 0;
              graphics.dispose();
              return Printable.NO_SUCH_PAGE;
          * This method initializes jButton1
          * @return javax.swing.JButton
         private javax.swing.JButton getJButton1()
              if (jButton1 == null)
                   jButton1 = new javax.swing.JButton();
                   jButton1.setText("Stop");
                   jButton1.addActionListener(new java.awt.event.ActionListener()
                        public void actionPerformed(java.awt.event.ActionEvent e)
                             if (pt != null)
                                  pt.stopMe();
                                  try
                                       Thread.sleep(1000);
                                  catch (Exception ee)
                                  pt = null;
              return jButton1;
    public static void main(String[] args)
         o = new PTest();
         o.setVisible(true);
    }

    Hi,
    I used to get serious GDI and memory leakage in my Swing apps.
    If you "program like a C++ programmer" you won't get it....
    ie.
    1. explicitely remove components from containers when you're finished.
    In fact I wrote a recursive function to start at a JFrame and recursively remove
    all Swing components from it.
    2. explicitely remove all listeners, actionlisterers, mouselisteners etc..
    They hold references to your Swing components, and stop them from being
    garbage collected. So, that nasty habit of yours to use anonymous classes
    as actionlisteners must stop ! I prefer to let the class, in your case PTest,
    implement the actionlisteners, and then just call addActionListener(this).
    So, my guess is, it's not to do with the Printing as such.
    regards,
    Owen

  • GDI limits: what else can be done to raise them

    Using Syinternals testlimit -g on a x86 Server 2003 SP2, I've noticed that seems to exist a 64Kb limit, despite GDIProcessHandleQuota registry setting allowing over 65k objects:
    We are really limited to a maximum 65535 GDI objects limit on a 64Kb space?
    What else could be done to raise this GDI limit?

    Hi CCJ, 
    Yes, you can increase the limit by doing below reg changes.
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\GDIProcessHandleQuota
    This value can be set to a number between 256 and 65,536.
    Here is Technet
    link (GDI Objects) for your reference.
    Regards, Ravikumar P

  • Report Builder 3.0 - Not enough storage is available to process this command

    I have a customer who uses Report Builder to create adhoc reports against a SQL data warehouse.  However, users intermittently encounter the exception "Not enough storage is available to process this command", which appears to relate
    to creating/drawing the report.
    It would appear that a user can define the required Report SQL, run the report and export it to Excel.  However, on occasions, when the user reviews/amends the report SQL, or specify a new value for a existing report parameter, and then try to run the
    report, they get an exception, as per the snippet below:-
    System.ComponentModel.Win32Exception: Not enough storage is available to process this command
       at System.Drawing.BufferedGraphicsContext.CreateCompatibleDIB(IntPtr hdc, IntPtr hpal, Int32 ulWidth, Int32 ulHeight, IntPtr& ppvBits)
       at System.Drawing.BufferedGraphicsContext.CreateBuffer(IntPtr src, Int32 offsetX, Int32 offsetY, Int32 width, Int32 height).
    The error can also occur after trying to re-export the report to excel. In this case the export works.
    In all cases, the user is given the option to continue or quit, but clicking continue just causes the error to be re-displayed so the user has to quit Report Builder and re-open it..
    We have monitored the user's resources (citrix session) and they are not using all their RAM or temporary folder space.

    Hi jocelyn,
    As per my understanding, you got the error on occasions when you change the parameters to run the report, export it to excel or preview the report, right?
    Did your report have large amount of rows or columns or did you have image or chart in the report? Did this issue happened on the other reports too?
    Your issue can be caused by many factors:
    If you have some image or chart in the report. Based on the callstack crashing at System.Drawing, it looks like GDI+ may be a problem. Make sure you have the latest updates installed for GDI+. The interaction of the content of the report with GDI+
    may also be something to investigate. If you have many images in the report, each image is a distinct GDI object and could potentially cause a problem.
    It also probably running out of space on your computer, so you may need to check the space on your c: drive. If you are running out space, you can try to reboot the computer or delete a few things or somehow getting a bigger hard drive to check the
    issue again.
    If the issue only happend on this report, I recommend you to recreate an same report to have a test.
    Similar thread below for your reference:
    SharePoint 2010 SSRS Integrated - Report Hangs and crashes
    System.ComponentModel.Win32Exception: Not enough storage
    is available to process this command
    Not enough storage is available to complete this operation
    If your issue still exists, please feel free to ask.
    Regards,
    Vicky Liu
    Vicky Liu
    TechNet Community Support

  • Problem with FrameMaker 9 on Windows 7

    A member of my unit is running FrameMaker 9 on Windows 7 with a 64bit machine and has come across a strange problem.
    Whenever he has a file open for too long his FramMaker will crash once he tries to work with the file again. This usually takes a few hours before this problem arises. In trying to figure out what was going on we took a look at Windows Task Manager. We noticed that once we opened a FrameMaker file the GDI Objects for FrameMaker continued to grow steadily even when we weren’t touching the file or doing any work in FrameMaker. The value under FrameMaker GDI Objects continued to grow until it reached some point around 10 000  then FrameMaker would either crash (if the GDI Objects passed 10 000) or it would crash once one tried to open another FrameMaker file (because that would make the GDI Objects increase to over 10 000).
    Has anyone else encountered this problem? Does anyone know of a way to fix this problem?

    I actually have a similar problem with my machine. I am running FrameMaker 9 with Windows XP on a 32bit machine.
    The problem is slightly different because on my machine the GDI Objects doesn't continue to increase over time it increases with the number of files I open and close. Every time I open a file the number of FrameMaker GDI Objects increase and when I close the file the number of GDI Objects decreases a little but not down to the original value, so when I open and close a lots of FrameMaker files the number continues to increase until it reaches 10 000 then my FrameMaker crashes.

  • OSX inactive memory management problems

    On my 2010 Macbook Air 11" running OSX 10.8 Mountain Lion, I have run into some major issues with memory management. This problem persists across both my Mac machines and multiple generations of OSX. I have a 2007 2.2 Ghz Core 2 Duo Macbook Pro Running Lion (upgraded from Tiger) with 3 gb 667Mhz DDR2 RAM and my 2010 Air 1.4Ghz Core 2 Duo (Upgraded from Snow Leopard to Mountain Lion) with 2gb 1067mhz DDR3 RAM. On both machines, for some time now, during normal usage; especially web browsing using Chrome and Safari (respectively); the inactive RAM on both machines will grow to consume around 30% of all RAM and force time consuming page outs to the mass storage drives on both machines. The Pro has a slower hard drive and the problem is the worst here, the air has a much faster SSD. I have found myself constantly having a window of Activity Monitor up on at least one of my desktops watching my RAM usage, using terminal to purge ram upwards of 10 times an hour to prevent costly page outs, especially on the Pro. I know Apple claims that inactive RAM is essentially free RAM that is temporarily storing recently used information for ease of access later and that it's supposed to be released as free memory when needed, but this obviously is not happening. Right now on my air my swap file is over 650Mb and I've seen it top 2Gb before. The air is exponentially better than the Pro due to the faster SSD, but I do notice substantial UI lag and a massive drop in fluidity as soon as my meager 2Gb is full and I start paging. The Pro is another story entirely, the entire system will essentially become unusable, having to wait several seconds for mouse clicks to even register. That's why I upgraded the stock 2Gb of RAM it comes with to 3Gb hoping that a 150% increase in RAM would help, but it just prolonged the inevitable. I still end up paging out just as bad across both systems if un checked. Even when I keep a close eye on memory usage and purge often, I still end up paging out because I'm not vigilant enough.
    I have to limit my browsing to less than 5 tabs and keep my number of open programs less than 2 on both machines. My active and wired memory rarely seem to top 70%, meaning the rest gets taken by inactive, which isn't functioning as Apple claims. Even if my conclusions aobut what is happening under the hood are incorrect, something is going terribly wrong. I can't upgrade the RAM on my Air at all, and the RAM on my Pro is capped at 4Gb. I'm holding on upgrading because I don't think the excess hardware will solve this software memory problem. Whatever is happening is causing a serious drop in performance for me (yes I do know I have underpowered machines), but there has to be something I can do to speed performance. I've read about disabling the dynamic page file entirely, which just seems to crash the system when free memory is gone, and I've read about programs that claim to free memory. Those programs seem to work by taking a high priority in the process heigharchy of the OS and then proceeding to eat up large portions of RAM and releasing them as needed in an attempt to replicate the true intentions of inactive RAM, but I've heard of problems with this method as well. Does anyone have a viable solution? Monitoring my RAM usage myself and ensuring I don't end up paging out is costly, time consuming, annoying, and inefficient since I fail to catch the problem before I page if I get particularly busy. There is no other OS I've ever been acquainted with that has this problem, not any flavor of Linux, not even the dreaded windows. I seriously hope Apple can do something to manage this runaway memory problem. I'd like to be able to open more than 3 windows in Safari. I've had to purge 3 seperate times while writing this on my Air, and I now have 678 inactive memory, 741 inactive, 582 wired, and less than 14Mb free out of 2Gb with a growing swap at 680Mb. Each purge becomes less and less effective and the last one I did freed up only about 100Mb and it got eaten up again by inactive in less than 10 seconds. On my Air, the memory hog is Safari right now at 700Mb between the web content and flash player with only Facebook, youtube, and this Apple Supprt tab open. I have NO other applications running in the fore or background other than Activity Monitor and Terminal. On my Pro the memory hog is always kernel task, I use Chrome and Safari both. While the memory used by the browser does not usually take up the most substantial portion of the total used RAM out of any process, the more tabs I open, the more RAM I use. The browser is usually the second heaviest RAM hog to Kernel Task. So it seems that across the two machines there are two lsightly different manifestations of the same problem with the same results: massive performance drops and extremely annoying and costly page outs no matter the reason. I just want this problem to go away. I've used underpowered windows laptops that can open a dozen tabs in a heavier browser like IE or Firefox while using other programs like Word or Excel and more with no memory lag issues. There's no way in **** I could manage to open that many pages in a browser while using Pages and/or Numbers on either of my machines and expect reliable (swap free performance). This is just kind of sad in my opinion. Does anyone have a way to get my OSX machine running smooth so that I can remove the one thing that windows and Linux fan boys get the right to laugh at my Macs for?

    Hi Zephryl,
    I was actually able to get an initial response from Sun on this a few months ago. However, the Sun Swing team has not followed up on a resolution for this pervasive problem, even though they noticed the same problem when running a test applet I had created for them. Apparently, I.E. is not releasing memory from the heap.
    Below is a quote from a Sun rep. on this in an e-mail sent to me on Dec 4, 2002:
    "I suspected the leak is in the native code because the # of handles and GDI objects keep increasing but no obvious Java objects are left behind in the Java heap during page switch."
    So, until Sun and/or Microsoft work out a solution to this, anyone who uses I.E. 6 and applets for their UI seems to be in a lot of trouble.
    As a note, trying to invoke the Garbage Collector does not do anything, but generally a very small amount of memory will be released (like maybe 5-10% of the memory allocated for the applet).
    Cheers!
    Avi Gray
    Global Computer Enterprises

Maybe you are looking for

  • ERROR Installing SAP NetWeaver PI 7.1 EHP 1 on Windows Server 2008 R2 x64

    Hi! I'm trying to install SAP NWPI 7.1 on a Windows Server 2008 R2 Standard, but in the step "Create Java User" stop the process when this creating the SAPJSF user, here's my system specifications: OS: Windows Server 2008 R2 x64 Standard RAM: 2 GB Fr

  • Session attribute cached

    Hi there, I have a problem with logging my user out. I have searched through this forum and tried all the methods listed including: 1) At the logout page I did this: session.invalidate(); session = request.getSession(true); 2) I did this on all my JS

  • Datasources validation

    Hi Bi Experts. I have an issue... how can I be sure than each Bi Content Datasource implemented, are extracting correctly the information from the ECC system? Is there a method to verify that the information in BW is exactly the same than in ECC syst

  • Mail re-sizing attachment

    Hi I needed to send some photographs to a newspaper so I wanted to send them full size. The photos are stored in iPhoto so I selected the first and pressed Email. Despite selecting Actual Size in Mail, the size dropped from 9.3mb to 5.3? Does anyone

  • CS3 Illustrator: Extreme slow with opening file

    Hi all, I have the following problem on a Win XP desktop pc with 2Gb RAM: When opening a file in Illustrator it takes up to 2 minutes before the file opens. During that time the program hangs (not responding). The problem started last week, but befor