Results 1 to 4 of 4
Thread: Max size for a passed parameter?
- 01-29-2010, 03:11 PM #1
Member
- Join Date
- Jan 2010
- Posts
- 1
- Rep Power
- 0
Max size for a passed parameter?
Hello.
I've recently started coding seriously in Java, and I'm developing a little application that gathers information from the user, stores it in a vector, and then stores that vector in a vector of vectors.
This Vector<Vector> gets passed to a few methods and it occurred to me that this vector could get very large if the user keeps inputting data, which prompts my post.
Is there a maximum size for a passed parameter? Will there be exceptions or errors if the vector gets too large?
Thanks in advance.
- 01-29-2010, 03:17 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,604
- Blog Entries
- 7
- Rep Power
- 17
If you pass a primitive value (e.g. an int or a double etc.) you actually pass a copy of the value which takes up as much as 8 bytes. If you pass an object you actuall pass a copy of the reference (pointer) to the object which takes typically 4 bytes. As long as there are free bytes in the heap and you can store the object it can be passed as a parameter as long as there are at least 4 bytes available on the stack.
kind regards,
Jos
- 01-29-2010, 04:26 PM #3
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
If the Vector (and you really ought to be using some form of List) gets really really really big you would eventually hit an OutOfMemory, but that has nothing to do with parameters.
- 01-29-2010, 06:27 PM #4
Member
- Join Date
- Aug 2009
- Posts
- 76
- Rep Power
- 0
Similar Threads
-
entities are passed by value or passed by reference
By syntrax in forum New To JavaReplies: 1Last Post: 12-17-2009, 07:13 AM -
java certification passed
By natasha in forum Java CertificationReplies: 0Last Post: 12-05-2009, 08:24 AM -
Setting frame size to the size of an image
By Yoruichi in forum AWT / SwingReplies: 5Last Post: 04-22-2009, 04:37 PM -
Cannot get passed these syntax errors
By MrKP in forum New To JavaReplies: 1Last Post: 05-12-2008, 07:05 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks