• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

memory

 
vijayapriya thirumurugan
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

hello sir,


Object[][] el=new Object[100][100];
It is working. but i need Object[][] el=new Object[100000][100000];

you sent if i declare

int n=100000;
Object[][] el=new Object[n][n];
it'll work. but it doesn't work.

the error: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
can i store 100000 of values.
 
Rob Spoor
Sheriff
Pie
Posts: 20514
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you do a search you'll find several posts that explain how to assign more memory to the JVM. How much you'll need I can't tell you though, you'll have to play around a bit with different values.
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are not storing 100000 values in the second example, but 10000000000. You will require a heap space of several tens of GB to fit it in. Most PCs don't have that amount of memory available at all.
 
Brian Legg
Ranch Hand
Posts: 488
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are you doing exactly that you would need to do something like that? or are you just testing the JVM limits?

There are more than likely several different work-arounds to doing something like that. Do you really need 10 billion objects in memory all at the same time? Couldn't you read/write/execute/whatever your objects a few at a time? If this is a real problem that you need help with than please give us more details to assist you with. Increasing your system memory is not a good solution in my opinion because I can't think of a single situation in which you would have to have 10 billion objects in memory at one time.
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you need 10000000000 (= 100 crore) objects, you would do better to put them into a database. That will happily hold that many objects, assuming you have enough hard drive space.
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

10000000000 (= 100 crore)


that sounds more Indian
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Balu Sadhasivam wrote:that sounds more Indian
Very definitely English . . . but I try to speak your language
 
Sridhar Santhanakrishnan
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:1000,00,00,000 (= 100 crore) objects



More like 1000 crore. But full marks for the effort
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did say "try". I'm glad I didn't say "Succeed"
 
Brian Legg
Ranch Hand
Posts: 488
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok.... what's a crore? Let the rest of us in
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought it was 10^8 (100,000,000) but it is actually 10^7 (10,000,000).
 
Brian Legg
Ranch Hand
Posts: 488
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So it's an Indian word that represents 10 million? Why would you need such a measurement? The largest measurement I can think of for money that isn't a real number would be a grand or $1,000 :P

 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe it's the number of Java programmers in Bangalore?

But let's get this thread back on topic
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic