[Scilab-users] SciLab: possible bug in graphics.

aweeks at hidglobal.com aweeks at hidglobal.com
Fri Jun 13 12:07:47 CEST 2014



Hi Everyone,

One of my programs has a 'terminal' where incoming text is shown.  I've
done this by writing text to a graphics figure.  The text is stored as a
global vector ('displaytext') consisting of lines (strings) which are
written to the figure by means of the handle to the text entity
(texthdl.text = displaytext).  The code for this is shown below.
The display is updated around four times per second.
Notice also an eventhandler in the figure, which allows the looping which
generates the text to be stopped.

All too often SciLab crashes and the error messages which appear in the
console are shown below.

I've tried to work around this by closing and re-opening the figure after
#disptot lines have been written - this is the purpose of variables
'disptot' and 'restart'.  However, #disptot can be quite low, 40 say, and
SciLab will still crash.
It looks to me like memory is not being freed after use and so runs out.  I
haven't been able to work out whether it's the number of lines or the
number of characters which determines how soon it crashes.

Any suggestions ?
This looks like a bug to me.  Are there any fixes ?

Alternatively, if I knew what made it crash I might be able to make the
software adaptive so it only re-opens the figure as infrequently as
necessary - re-opening the figure is slightly annoying, having to
continually close and re-launch SciLab is a real pain.

I'm using SciLab 5.4.0 in Windows XP SP3 32 bit.

Many thanks in anticipation,

Adrian.




#ldisplay = 50
#disptot = 100

function StartDisplay(restart)

    global figrhdl;
    global texthdl;
    global displaytext;
    global disptot;
    global stophdl;

    disptot = 0;

    figrhdl = scf(1);
    figrhdl.figure_position = [#fig1_xTLC, #fig1_yTLC];
    figrhdl.figure_size = [#fig1_width, #fig1_height];
    figrhdl.figure_name = "Message window.";

    xstring(-0.1,1.1,"LEFT CLICK HERE TO STOP LOOPING");
    stophdl = gce();
    stophdl.font_style = 0;
    stophdl.font_size = 2;
    stophdl.box = 'on';

    seteventhandler('StopLoop');
    figrhdl.event_handler = 'StopLoop';
    figrhdl.event_handler_enable = 'on';

    if ~restart then						// if restart = %t the displaytext is not cleared
        displaytext(1: #ldisplay) = " ";
    end

    xstring(-0.1, -0.1, displaytext);				// this writes the text initially
    texthdl = gce();
    texthdl.font_style = 0;
    texthdl.font_size = 2;

endfunction

function DisplayText(textlines, clrfirst)

    global figrhdl;
    global texthdl;
    global displaytext;
    global disptot;

    if clrfirst then displaytext(1: #ldisplay) = " "; end		// if clrfirst =
%t then displaytext is cleared

    nlines = size(textlines, 'r');				// these lines, from here
    offset = #ldisplay - nlines;

    if nlines < #ldisplay then
        i = 1: offset;
        displaytext(i) = displaytext(i + nlines);

        i = 1: nlines;
        displaytext(offset + i) = textlines(i) + ' ';
    else
        i = 1: #ldisplay;
        displaytext(i) = textlines(i - offset) + ' ';
    end							// to here update displaytext by replacing lines with the new
'textlines'

    if disptot >= #disptot then				// if disptot lines have been written the
figure is closed and re-opened
        close(figrhdl);
        StartDisplay(%t);
    end

    texthdl.text = displaytext;				// this writes the text to the figure
    disptot = disptot + 1;

endfunction




Exception in thread "Thread-1782" javax.media.opengl.GLException:
java.lang.reflect.InvocationTargetException
	at javax.media.opengl.awt.GLJPanel.display(GLJPanel.java:265)
	at org.scilab.forge.scirenderer.implementation.jogl.JoGLCanvas
$CanvasAnimator.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
	at java.awt.EventQueue.invokeAndWait(Unknown Source)
	at javax.media.opengl.awt.GLJPanel.display(GLJPanel.java:263)
	... 2 more
Caused by: java.lang.OutOfMemoryError: Java heap space
	at java.awt.image.DataBufferInt.<init>(Unknown Source)
	at java.awt.image.Raster.createPackedRaster(Unknown Source)
	at java.awt.image.DirectColorModel.createCompatibleWritableRaster
(Unknown Source)
	at java.awt.image.BufferedImage.<init>(Unknown Source)
	at org.scilab.forge.scirenderer.texture.TextureBufferedImage.<init>
(Unknown Source)
	at
org.scilab.forge.scirenderer.texture.BufferedImageTextureDrawingTools.<init>
(Unknown Source)
	at
org.scilab.forge.scirenderer.texture.DrawnTextureDataProvider.reDraw
(Unknown Source)
	at
org.scilab.forge.scirenderer.texture.DrawnTextureDataProvider.getImage
(Unknown Source)
	at
org.scilab.forge.scirenderer.texture.DrawnTextureDataProvider.getSubImage
(Unknown Source)
	at
org.scilab.forge.scirenderer.implementation.jogl.texture.JoGLTextureManager
$JoGLTexture.checkData(Unknown Source)
	at
org.scilab.forge.scirenderer.implementation.jogl.texture.JoGLTextureManager
$JoGLTexture.preDraw(Unknown Source)
	at
org.scilab.forge.scirenderer.implementation.jogl.texture.JoGLTextureManager.draw
(Unknown Source)
	at
org.scilab.forge.scirenderer.implementation.jogl.JoGLDrawingTools.draw
(Unknown Source)
	at org.scilab.modules.renderer.JoGLView.text.TextManager.draw(Unknown
Source)
	at org.scilab.modules.renderer.JoGLView.DrawerVisitor.visit(Unknown
Source)
	at org.scilab.modules.graphic_objects.textObject.Text.accept(Unknown
Source)
	at
org.scilab.modules.renderer.JoGLView.DrawerVisitor.askAcceptVisitor(Unknown
Source)
	at org.scilab.modules.renderer.JoGLView.axes.AxesDrawer.draw(Unknown
Source)
	at org.scilab.modules.renderer.JoGLView.DrawerVisitor.visit(Unknown
Source)
	at org.scilab.modules.graphic_objects.axes.Axes.accept(Unknown
Source)
	at
org.scilab.modules.renderer.JoGLView.DrawerVisitor.askAcceptVisitor(Unknown
Source)
	at org.scilab.modules.renderer.JoGLView.DrawerVisitor.visit(Unknown
Source)
	at org.scilab.modules.graphic_objects.figure.Figure.accept(Unknown
Source)
	at org.scilab.modules.renderer.JoGLView.DrawerVisitor.draw(Unknown
Source)
	at
org.scilab.forge.scirenderer.implementation.jogl.JoGLCanvas.display(Unknown
Source)
	at jogamp.opengl.GLDrawableHelper.displayImpl
(GLDrawableHelper.java:189)
	at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:177)
	at javax.media.opengl.awt.GLJPanel$Updater.display(GLJPanel.java:655)
	at jogamp.opengl.GLDrawableHelper.displayImpl
(GLDrawableHelper.java:189)
	at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:177)
	at jogamp.opengl.GLPbufferImpl$DisplayAction.run
(GLPbufferImpl.java:300)
	at jogamp.opengl.GLDrawableHelper.invokeGLImpl
(GLDrawableHelper.java:425)
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java
heap space
	at java.awt.image.DataBufferInt.<init>(Unknown Source)
	at java.awt.image.Raster.createPackedRaster(Unknown Source)
	at java.awt.image.DirectColorModel.createCompatibleWritableRaster
(Unknown Source)
	at java.awt.image.BufferedImage.<init>(Unknown Source)
	at org.scilab.forge.scirenderer.texture.TextureBufferedImage.<init>
(Unknown Source)
	at
org.scilab.forge.scirenderer.texture.BufferedImageTextureDrawingTools.<init>
(Unknown Source)
	at
org.scilab.forge.scirenderer.texture.DrawnTextureDataProvider.reDraw
(Unknown Source)
	at
org.scilab.forge.scirenderer.texture.DrawnTextureDataProvider.getImage
(Unknown Source)
	at
org.scilab.forge.scirenderer.texture.DrawnTextureDataProvider.getSubImage
(Unknown Source)
	at
org.scilab.forge.scirenderer.implementation.jogl.texture.JoGLTextureManager
$JoGLTexture.checkData(Unknown Source)
	at
org.scilab.forge.scirenderer.implementation.jogl.texture.JoGLTextureManager
$JoGLTexture.preDraw(Unknown Source)
	at
org.scilab.forge.scirenderer.implementation.jogl.texture.JoGLTextureManager.draw
(Unknown Source)
	at
org.scilab.forge.scirenderer.implementation.jogl.JoGLDrawingTools.draw
(Unknown Source)
	at org.scilab.modules.renderer.JoGLView.text.TextManager.draw(Unknown
Source)
	at org.scilab.modules.renderer.JoGLView.DrawerVisitor.visit(Unknown
Source)
	at org.scilab.modules.graphic_objects.textObject.Text.accept(Unknown
Source)
	at
org.scilab.modules.renderer.JoGLView.DrawerVisitor.askAcceptVisitor(Unknown
Source)
	at org.scilab.modules.renderer.JoGLView.axes.AxesDrawer.draw(Unknown
Source)
	at org.scilab.modules.renderer.JoGLView.DrawerVisitor.visit(Unknown
Source)
	at org.scilab.modules.graphic_objects.axes.Axes.accept(Unknown
Source)
	at
org.scilab.modules.renderer.JoGLView.DrawerVisitor.askAcceptVisitor(Unknown
Source)
	at org.scilab.modules.renderer.JoGLView.DrawerVisitor.visit(Unknown
Source)
	at org.scilab.modules.graphic_objects.figure.Figure.accept(Unknown
Source)
	at org.scilab.modules.renderer.JoGLView.DrawerVisitor.draw(Unknown
Source)
	at
org.scilab.forge.scirenderer.implementation.jogl.JoGLCanvas.display(Unknown
Source)
	at jogamp.opengl.GLDrawableHelper.displayImpl
(GLDrawableHelper.java:189)
	at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:177)
	at javax.media.opengl.awt.GLJPanel$Updater.display(GLJPanel.java:655)
	at jogamp.opengl.GLDrawableHelper.displayImpl
(GLDrawableHelper.java:189)
	at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:177)
	at jogamp.opengl.GLPbufferImpl$DisplayAction.run
(GLPbufferImpl.java:300)
	at jogamp.opengl.GLDrawableHelper.invokeGLImpl
(GLDrawableHelper.java:425)




                                          
 Adrian Weeks                             
 Development Engineer                     
                                          
                                          
 HID Global,                              
 3 Cae Gwyrdd,                            
 Green Meadow Springs                     
 Business Park,                           
 Cardiff CF15 7AB,                        
 United Kingdom.                          
 +44 (0)29 20528523                       
 (Office)                                 
 aweeks at hidglobal.com                     
 www.hidglobal.com                        
                                          

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20140613/23b9dde1/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 12696196.gif
Type: image/gif
Size: 4559 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20140613/23b9dde1/attachment.gif>


More information about the users mailing list