Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

OutOfMemory error in java.awt.image.DataBufferInt.<init>

843807Jun 28 2010 — edited Jul 22 2010
We have an applet application that performs Print Preview of the images in the canvas. The images are like a network of entities (it has pictures of the entities involve (let's say Person) and how it links to other entities). We are using IE to launch the applet.

We set min heap space to 128MB, JVM max heap space to 256MB, java plugin max heap space to 256MB using the Control Panel > Java.

When the canvas width is about 54860 and height is 1644 and perform Print Preview, it thows an OutOfMemoryError in java.awt.image.DataBufferInt.<int>, hence, the Print Preview page is not shown. The complete stack trace (and logs) is as follows:
Width: 54860 H: 1644
Max heap: 254 # using Runtime.getRuntime().maxMemory()
javaplugin.maxHeapSize: 256M # using System.getProperties("javaplugin.maxHeapSize")
n page x n page : 1x1
Exception in thread "AWT-EventQueue-2" 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 com.azeus.gdi.chart.GDIChart.preparePreview(GDIChart.java:731)
at com.azeus.gdi.chart.GDIChart.getPreview(GDIChart.java:893)
at com.azeus.gdi.ui.GDIUserInterface.printPreviewOp(GDIUserInterface.java:1526)
at com.azeus.gdi.ui.GDIUserInterface$21.actionPerformed(GDIUserInterface.java:1438)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Drilling down the cause of the problem. The OutOfMemory occurred in the constructor of DataBufferInt when it tried to create an int array:
public DataBufferInt(int size) {
super(STABLE, TYPE_INT, size);
data = new int[size]; # this part produce out of memory error when size = width X height
bankdata = new int[1][];
bankdata[0] = data;
}

The OutOfMemory error occurred when size is width * height (54860 X 1644) which is 90,189,840 bytes (~86MB).

I can replicate the OutOfMemory error when initiating an int array using a test class when it uses the default max heap space but if I increase the heap space to 256MB, it cannot be replicated in the test class.

Using a smaller width and height with product not exceeding 64MB, the applet can perform Print Preview successfully.

Given this, I think the java applet is not using the value assigned in javaplugin.maxHeapSize to set the max heap space, hence, it still uses the default max heap size and throws OutOfMemory in int array when size exceeds the default max heap space which is 64MB.

For additional information, below is some of the java properties (when press S in java applet console):
browser = sun.plugin
browser.vendor = Sun Microsystems, Inc.
browser.version = 1.1
java.awt.graphicsenv = sun.awt.Win32GraphicsEnvironment
java.awt.printerjob = sun.awt.windows.WPrinterJob
java.class.path = C:\PROGRA~1\Java\jre6\classes
java.class.version = 50.0
java.class.version.applet = true
java.runtime.name = Java(TM) SE Runtime Environment
java.runtime.version = 1.6.0_17-b04
java.specification.version = 1.6
java.vendor.applet = true
java.version = 1.6.0_17
java.version.applet = true
javaplugin.maxHeapSpace = 256M
javaplugin.nodotversion = 160_17
javaplugin.version = 1.6.0_17
javaplugin.vm.options = -Xms128M -Djavaplugin.maxHeapSpace=256M -Xmx256m -Xms128M
javawebstart.version = javaws-1.6.0_17

Kindly advise if this is a bug in JRE or wrong setting. If wrong setting, please advise on the proper way to set the heap space to prevent OutOfMemory in initializing int array.

Thanks a lot.

Edited by: rei_xanther on Jun 28, 2010 12:01 AM

Edited by: rei_xanther on Jun 28, 2010 12:37 AM

Comments

If AUTOREST is enabled on "gator$session", not sure how the handler is created.
Try creating handlers manually call the PROC over rest.
Ref below documents:
Oracle REST Data Services (ORDS) : Create Basic RESTful Web Services Using PL/SQL (0 Bytes)
Installation, Configuration, and Development Guide (0 Bytes)
How to Build a REST API that calls a PL/SQL Function w/ORDS (0 Bytes)Thakns, Suresh

User_0ZK6U

Thanks for the info. Nothing really jumped out at me other than than maybe needing to enable the database package, which I did using ords.enabled_object with the p_object_type as 'PACKAGE'. But no improvement.
Is there a way to tell if ORDS is actually recognizing that /ords/gator/ is associated with enabled schema? I can see the url requested being logged by Tomcat but not what if anything ORDS is doing.
is the command below giving ORDS what it needs to see the GATOR database or is something else needed:
alter user GATOR grant connect through ORDS_PUBLIC_USER;

thatJeffSmith-Oracle

there's the plsql gateway - no ords_public_user
and there's autorest - enable schema, enable plsql, call it - via ords_public_user

Pick one - the REST side is the modern way to go...

User_0ZK6U

I tried following the steps at oss.oracle.com/projects/mod_owa/dist/documentation/ords_setup.htm looking for steps I might have missed. I did seem to miss:

java -jar ords.war map-url --type base-path /gator gator

I tried running ORDS in standalone mode with debugging enabled. When I get the 404 No Found error nothing shows up on the console but I do get a DispatcherNotFoundException stack strace in my browser window, which doesn't help me.
Is there a guide somewhere that lays out the specific steps needed to get a PL/SQL Web Application that uses the PL/SQL Web Toolkit working with ORDS? I am not needing to call PL/SQL as web services - I just want to render web pages.

User_0ZK6U

I went into the gator.xml settings in the ords\conf folder and changed the db.port from 8080 to 1521. My Tomcat is at 8080, but ORDS is at 1521.
I still get a 404 No Found error, but with a ProcedureNotFoundException saying the procedure named gator$session.Hello could not be accessed. The package/procedure is in the XEPDB1/GATOR schema. Do I need to grant execute privilege to some ORDS or APEX account? I tried granting execute to the package to both ORDS_PUBLIC_USER and APEX_PUBLIC_USER.
The exception is coming from oracle.dbtools.apex.ModApex.validateRequest.

thatJeffSmith-Oracle

I went into the gator.xml settings in the ords\conf folder and changed the db.port from 8080 to 1521. My Tomcat is at 8080, but ORDS is at 1521.

Ok...so in the tomcat logs when ords starts are the pools able to be created? Do you see connections in our database that match the connection pool users?

User_0ZK6U

I am running ORDS standalone for now. Tomcat is not running.

thatJeffSmith-Oracle

so same question then, ords logs/STDOUT, what do you see when it starts, and what do you see in your database?

User_0ZK6U

Standalone ORDS console output
2021-10-13T18:32:40.950Z INFO HTTP and HTTP/2 cleartext listening on host: localhost port: 8080
2021-10-13T18:32:41.028Z INFO Disabling document root because the specified folder does not exist: c:\Temp\ords\ords\standalone\doc_root
2021-10-13T18:32:46.082Z INFO Configuration properties for: |apex||
database.api.enabled=true
db.connectionType=basic
db.hostname=localhost
db.port=1521
db.servicename=XEPDB1
debug.debugger=true
debug.printDebugToScreen=true
feature.sdw=true
restEnabledSql.active=true
security.requestValidationFunction=wwv_flow_epg_include_modules.authorize
security.validationFunctionType=plsql
db.password=******
db.username=APEX_PUBLIC_USER
resource.templates.enabled=true

2021-10-13T18:32:46.098Z WARNING *** jdbc.MaxLimit in configuration |apex|| is using a value of 10, this setting may not be sized adequately for a production environment ***
2021-10-13T18:32:46.099Z WARNING *** jdbc.InitialLimit in configuration |apex|| is using a value of 3, this setting may not be sized adequately for a production environment ***
2021-10-13T18:32:47.650Z INFO Configuration properties for: |apex|al|
database.api.enabled=true
db.connectionType=basic
db.hostname=localhost
db.port=1521
db.servicename=XEPDB1
debug.debugger=true
debug.printDebugToScreen=true
feature.sdw=true
restEnabledSql.active=true
security.requestValidationFunction=wwv_flow_epg_include_modules.authorize
security.validationFunctionType=plsql
db.password=******
db.username=APEX_LISTENER
resource.templates.enabled=true

2021-10-13T18:32:47.652Z WARNING *** jdbc.MaxLimit in configuration |apex|al| is using a value of 10, this setting may not be sized adequately for a production environment ***
2021-10-13T18:32:47.654Z WARNING *** jdbc.InitialLimit in configuration |apex|al| is using a value of 3, this setting may not be sized adequately for a production environment ***
2021-10-13T18:32:48.113Z INFO Configuration properties for: |apex|pu|
database.api.enabled=true
db.connectionType=basic
db.hostname=localhost
db.port=1521
db.servicename=XEPDB1
debug.debugger=true
debug.printDebugToScreen=true
feature.sdw=true
restEnabledSql.active=true
security.requestValidationFunction=wwv_flow_epg_include_modules.authorize
security.validationFunctionType=plsql
db.password=******
db.username=ORDS_PUBLIC_USER
resource.templates.enabled=true

2021-10-13T18:32:48.116Z WARNING *** jdbc.MaxLimit in configuration |apex|pu| is using a value of 10, this setting may not be sized adequately for a production environment ***
2021-10-13T18:32:48.116Z WARNING *** jdbc.InitialLimit in configuration |apex|pu| is using a value of 3, this setting may not be sized adequately for a production environment ***
2021-10-13T18:32:48.467Z INFO Configuration properties for: |apex|rt|
database.api.enabled=true
db.connectionType=basic
db.hostname=localhost
db.port=1521
db.servicename=XEPDB1
debug.debugger=true
debug.printDebugToScreen=true
feature.sdw=true
restEnabledSql.active=true
security.requestValidationFunction=wwv_flow_epg_include_modules.authorize
security.validationFunctionType=plsql
db.password=******
db.username=APEX_REST_PUBLIC_USER
resource.templates.enabled=true

2021-10-13T18:32:48.468Z WARNING *** jdbc.MaxLimit in configuration |apex|rt| is using a value of 10, this setting may not be sized adequately for a production environment ***
2021-10-13T18:32:48.468Z WARNING *** jdbc.InitialLimit in configuration |apex|rt| is using a value of 3, this setting may not be sized adequately for a production environment ***
2021-10-13T18:32:49.048Z INFO Configuration properties for: |gator||
database.api.enabled=true
db.connectionType=basic
db.hostname=localhost
db.port=1521
db.servicename=XEPDB1
debug.debugger=true
debug.printDebugToScreen=true
feature.sdw=true
restEnabledSql.active=true
security.requestValidationFunction=wwv_flow_epg_include_modules.authorize
security.validationFunctionType=plsql
db.password=******
db.username=APEX_PUBLIC_USER
resource.templates.enabled=true

2021-10-13T18:32:49.049Z WARNING *** jdbc.MaxLimit in configuration |gator|| is using a value of 10, this setting may not be sized adequately for a production environment ***
2021-10-13T18:32:49.050Z WARNING *** jdbc.InitialLimit in configuration |gator|| is using a value of 3, this setting may not be sized adequately for a production environment ***
2021-10-13T18:32:55.626Z INFO Oracle REST Data Services initialized
Oracle REST Data Services version : 20.3.0.r3011819
Oracle REST Data Services server info: jetty/9.4.30.v20200611

After startup I see the following connections in XEDPB1:
SQL> select sid, username from v$session where username is not null;
SID USERNAME


15 APEX\_PUBLIC\_USER                                                                                            
30 ORDS\_PUBLIC\_USER                                                                                            
32 APEX\_PUBLIC\_USER                                                                                          
154 APEX\_PUBLIC\_USER                                                                                          
155 ORDS\_PUBLIC\_USER                                                                                         
157 APEX\_PUBLIC\_USER                                                                                          
158 APEX\_REST\_PUBLIC\_USER                                                                                        
159 APEX\_PUBLIC\_USER                                                                                          
277 APEX\_LISTENER                                                                                            
278 ORDS\_PUBLIC\_USER                                                                                           
279 APEX\_REST\_PUBLIC\_USER                                                                                        
401 APEX\_LISTENER                                                                                             
402 APEX\_REST\_PUBLIC\_USER                                                                                         
404 APEX\_LISTENER                                                                                   
406 SYS                                                                                      
407 APEX\_PUBLIC\_USER
1 - 9
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Aug 19 2010
Added on Jun 28 2010
6 comments
9,256 views