3 ms·
I've been bitten by the "Long indices for arrays" lack once before. But then again, I had no reason for storing a String of length greater than MAX_INT in memor
by dajohnson89 11y ago
I've been bitten by the "Long indices for arrays" lack once before. But then again, I had no reason for storing a String of length greater than MAX_INT in memory in the first place. Streaming it was the better approach in my case.
Honest question: is there ever an acceptable case for having such a long String in memory?
- rdtsc 11y agoMaybe some large data structure in memory based on a flat array and indices underneath?
- andrew-lucker 11y agoSo would this affect all flat memory allocation? Say if you wanted to allocate 100GB for a bloom filter, would you need to break it into chunks?
- bad_user 11y agoYes, you'd need 6 arrays of 2147483648 longs (max int), plus one array of 536870912 longs, so a total of 7 arrays. Not that bad really.
- jerven 11y agoYes, I have code like that and its annoying and bug prone. Even if its a write one exercise :( Would be nice if could just avoid that exercise in bit shifting and anding.