Nawaz Ijaz

Greenhorn
+ Follow
since Nov 25, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Nawaz Ijaz

Hello Sri Ram,

We are migrating to Struts v1.3.10 from Struts v1.3.8.

I did not face the problem which you have mentioned in your post above. Could you please tell me what was the actual problem and how did you produce that? and how did you solved that problem??

So far it seems like a smooth migration activity. We are not facing any issue in our local environment?

can you tell me if there is/are any other issue(s) that we can face after migrating to Struts v1.3.10 from Struts v1.3.8?

Thanks and Kind Regards,
Nawaz
15 years ago
Hello Ulf, i've one more query for you.

1. In your opinion which image type is more resource/memory hungry. PNG or JPG?

2. I shall be rendering large images on PDF via iText. so what image type would you suggest me in this case?
15 years ago
Sorry for every thing which you did not like.. but that was really unintentional!

Thanks for the explanation Mr. Ulf :-)

Kind Regards,

Nawaz Ijaz
15 years ago

The image consumes roughly 60000*2300*4 = 526MB



Hello Dittmer, how did you calculate above value? Java BufferedImage.class tells that 'TYPE_INT_RGB' consumes 1 byte for one pixel??


Queries:
1. How much bytes will one pixel consume if i use the following line of code?
15 years ago
JVM allocate memory from HEAP during Run time and i think if the required 256MB memory could not be allocated by JVM to create Big Image using BufferedImage(..) then it will throw some exception like below;




AND WITH THE BELOW LINE;





Thank you Ulf Dittmer, you've been really helpful!
15 years ago
256MB = 268435456 Bytes
one pixel consume 4-bytes and this mean;

(Horizontal Dimension * Vertical dimension) = 268435456/4 = 67108864 pixels.

Queries
1. 67108864 should be the max value supported by IBM JDK?
2. what will be the impect of Heap Size in this case like what would happen if i set Heapsize= 512MB and likewise HeapSize=768MB?
15 years ago
Thanks for the detailed reply...

Constructing a BufferedImage object leads to an array being allocated that can hold all of the image. The heap size needs to be big enough to hold that array. The stack trace tells you in which classes and methods this happens - you can look at the source code if you're interested in the details.



==========================================================

There is no limit that BufferedImage imposes; see my first post.
But it begs the question: What are you trying to achieve by declaring a 60000 pixel wide image? Nobody is going to be able to view that.



Ya you are right.. the image will not be readable on paper (printout).. However user can read it by using Zoom-IN.
Actually i need to create a dynamic image and i want to know the maximum dimensions so that i could avoid above Exception.. and should be able to show some Error message in this case that image is too large to be displayed....
==========================================================
15 years ago
I've already increased dat heap size. this is not the issue..

Could you please answer to my queries?
15 years ago
Well at the maximum Java can allocate 256M memory to an Array. And i am getting below exception when i try to declare a big BufferedImage(..) object such as below;

=================
Code
=================


===================
Exception
===================




1. I am using IBM websphere 5.1 and under process definition i am declaring the Heap size like below;
Maximum Heap Size = 768.

2. i've also written a test class (posted in my first post) and i execute it using Xms command such as 'Xmx768m'.


================
My understanding
================
From the exception i could understand that 'Java can allocate 256M memory to an Array and BufferedImage also uses some Array in its internal mechanism'.


============
My Queries
============
1. Still i am unable to figure it out that how Heap size impect the declaration of BufferedImage Object?

2. And at what maximum horizontal/Vertical dimensions Java allow us to declare a BufferedImage Object?
15 years ago
Hello, Can any body me why am i getting the below exception? My Heap Size is 768MB. Actually i want to know how much Horizontal and Vertical dimension can java BufferedImage(..) method support. and how does this method work?

BufferedImage lvImage = new BufferedImage(60000, 2300, BufferedImage.TYPE_INT_RGB);


/ Nawaz

=================
CODE
=================



==================
EXCEPTION
==================



[Nitesh: Added code tags. Please UseCodeTags]
[ November 25, 2008: Message edited by: Nitesh Kant ]
15 years ago