Details
-
Type: Bug
-
Status: Closed
-
Priority: Critical
-
Resolution: Fixed
-
Affects Version/s: 1.8.1
-
Component/s: Framework, ICE-Components
-
Labels:None
-
Environment:byte[] type
Description
-
Hide
- ICE-4861.war
- 6.33 MB
- Adnan Durrani
-
- META-INF/MANIFEST.MF 0.0 kB
- index.jsp 0.1 kB
- WEB-INF/classes/com/.../ice03/MyBean.class 2 kB
- WEB-INF/lib/xercesImpl.jar 1.15 MB
- WEB-INF/lib/icefaces-comps.jar 1.91 MB
- WEB-INF/lib/commons-collections.jar 558 kB
- WEB-INF/lib/backport-util-concurrent.jar 319 kB
- WEB-INF/lib/commons-beanutils.jar 226 kB
- WEB-INF/lib/commons-logging.jar 52 kB
- WEB-INF/lib/jstl.jar 20 kB
- main.jspx 1 kB
- WEB-INF/.../krysalis-jCharts-1.0.0-alpha-1.jar 151 kB
- WEB-INF/web.xml 2 kB
- WEB-INF/lib/xml-apis.jar 190 kB
- WEB-INF/lib/icefaces.jar 1.13 MB
- WEB-INF/lib/commons-digester.jar 140 kB
- WEB-INF/lib/jsf-api.jar 356 kB
- WEB-INF/lib/jsf-impl.jar 778 kB
- WEB-INF/classes/com/.../ice03/MyBean.java 1 kB
- WEB-INF/lib/commons-fileupload.jar 56 kB
- WEB-INF/faces-config.xml 0.5 kB
Issue Links
- blocks
-
ICE-7311 Working with Icefaces 1.8.2 plugin for netbeans, ice:graphicImage in ice:panelSeries tag cannot correctly display byte image
- Closed
Activity
- All
- Comments
- History
- Activity
- Remote Attachments
- Subversion
One of the customer noticed a memory leak with graphicImage component when using byte[]. I used JProfiler to see it. I was able to see that on each image load the byte[] array was getting doubled. The old images were not garbage collecting.
Each file has different size, that is why bean creates a new byte array for each image, and that new byte array reference being used by the component for every new image . Seems like each reference is being held permanently.
Then I used the ByteArrayResource with graphic image, and did see the same behaviour. FYI: The byte[] also using the ByteArrayResource internally. Mark mentioned that resource API might keeping those references.
Yes, the dynamic resource implementation is keeping the registered resources until the session is expired.
I believe the solution to this issue would be to create a specific Resource implementation for graphicImage component. The resource would be registered only once by the component (not the renderer). The resource digest could be derived from the clientID and the InputStream should be created dynamically (every time is requested) from the byte array.
As per Mircea suggestion a custom resource added for byte[] type, which being registered once by the component itself.
Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\HtmlGraphicImage.java
Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\renderkit\ImageRenderer.java
Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\renderkit\ImageRenderer.java
Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\HtmlGraphicImage.java
Completed: At revision: 19198
There was already a case for this behaviour so I am linking the current custom issue to it. We are seeing what is potentially the problem but we are still evaluating the specifics and how to fix.
Re-opening and re-assigning.
After checking out the latest component code and compiling - which picked up the latest fix for this issue - my testing indicates the problem has been resolved. There is no longer an endless list of resources stored in the ResourceDispatcher's collection.
Test case attached