-8

I asked a question, https://stackoverflow.com/questions/28443972/how-can-i-create-a-large-int?noredirect=1#comment45217660_28443972.

Why was it marked as a duplicate of How can I increase the JVM memory? and Huge arrays throws out of memory despite enough memory available?

As I stated in the OP, then memory allocation clearly wasn't the issue, the other thing I "Duplicated" was talking only about single arrays, and not double or triple arrays.

Why was it marked as a duplicate? And why are people somehow insisting that they have the answers I need when they obviously don't (or else why would I post a new question)?

6
  • 9
    THe dupe-targets aren't unrelated. Actually, they answer your question, you just need to read them! Feb 10, 2015 at 23:48
  • @Deduplicator Please explain how they answer the question. One of them gives me a USELESS answer, of how I can increase the heap size (Which I will stress again is unrelated), and the second one only gives me an answer as of how to create a SINGLE array. I must be missing the obvious, but I don't see how.
    – Joehot200
    Feb 10, 2015 at 23:49
  • 7
    @Joehot200 as the asker, the onus is on your to explain why it isn't a duplicate. Someone who is an "expert" is java thought your question wad a duplicate, so you need to explain why it isn't. Feb 11, 2015 at 0:02
  • @psubsee2003 Fair enough. I'll remember that in future.
    – Joehot200
    Feb 11, 2015 at 0:04
  • 5
    What about the second answer? That one explicitely talks about multidimensional arrays, and not allocating them at once.
    – HugoRune
    Feb 11, 2015 at 0:10
  • 1
    actually if you read them for comprehension, they are both valid duplicate targets, especially the second one. Just because it is not the answer you want or is being spoon fed to you does not mean it is not the correct answer.
    – user177800
    May 12, 2016 at 16:41

1 Answer 1

6

It's a duplicate of the second question. Just because it was "only talking about single arrays" is irrelevant. Multidimensional arrays aren't significantly different in terms of memory semantics.

Read the answer to that second question you linked. It answers your question. It is a duplicate.

5
  • 1
    It doesn't answer my question. That's why it's not a duplicate.
    – Joehot200
    Feb 10, 2015 at 23:50
  • 4
    @Joehot200 But it does. You can use allocateDirect if necessary, as mentioned in that answer. Since you're not using jagged arrays in your multidimensional array, you can just use a contiguous block of memory. Feb 10, 2015 at 23:52
  • But, to get it as an int[], I have to use .toArray() on that IntBuffer, which only allows me to get a single-dimensional array?
    – Joehot200
    Feb 10, 2015 at 23:53
  • 4
    @Joehot200 I'm afraid you've run into the Law of Leaky Abstractions. If you're allocating that much memory, you need to be aware of how memory works, at least enough to understand the basics. A multidimensional array is not "magic", it can be simulated easily using a single array under the hood. (In fact, this is always how C arrays work.) Feb 10, 2015 at 23:55
  • 1
    Sighs I'm just going to scale the array down by 10 and then scale it up when I am doing my code. A full-size array would have been better, but I guess it'll do. Thank you for the help.
    – Joehot200
    Feb 11, 2015 at 0:02

Not the answer you're looking for? Browse other questions tagged .