I hope you're doing good. I was making the code for a program that will be dealing with a large number of array elements. For example, array A[] will have all the words that start with a letter "a". Now, if i put all in one class the program can't run due to not enough memory. I was going to make each array its own class. But in general, is there a better way to approach this instead of arrays? Or any other advice to wrestle with the many elements? I might be looking at 500k-1.xmil elements in the whole thing. Thank you in advance!
Asked
Active
Viewed 27 times
0
-
You don't have enough memory for just 500k strings? How much to do you have? That's not a "large" array. – sebnukem Oct 19 '16 at 18:22
-
Putting arrays to different classes doesn't decrease the memory usage in any way. Use a database or other external datasource instead. – Kayaman Oct 19 '16 at 18:23
-
Currently having all the Strings in a single array object will take less memory than splitting it up into a bunch of smaller arrays – RAZ_Muh_Taz Oct 19 '16 at 18:23
-
Well the test was done with a around 900k strings and I had around 3gb ram free, the script crashed and netbeans gave an error about insuffecient memory. So i threw 500k if i happen to reduce it to make it work. – rG57oU89l 3TuWe36Uj Oct 19 '16 at 18:38
-
Thank you, I'll be trying to make it into 1 value of a big string for each array and split it later. If that doesnt work, i guess i have to go with a database. – rG57oU89l 3TuWe36Uj Oct 19 '16 at 18:39