Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
He should have used List<int> = new List<int>{};
Seriously, he probably wanted infinite indexes, so... -
xalez19367ymade me think..
int[long.MaxValue] should be the same size as long[int.MaxValue] right?
since x*2x == 2x*x
🤔 -
@filthyranter I just yanked it out and initiated to 0 and added guard if statements. Size didn't need to be a long. I originally went the list route, but it was just taking image pixel data, so you only needed to set the size once. It was just amazing to me, especially since this was originally written for machines with like a gig of RAM max so a failure to set size would have led to the app trying to allocate 8+ gigs of RAM.
@xalez in C# longs are 64 bit. -
xalez19367y@sSam aaakh.. I feel dumb .. guess I shouldn't be doing much thinking when half asleep :/
-
Yeah, I calculated out the size of this array if it was allocated 100% in that call. It was somethin ? Like 8.8 gigs.
So today I saw this guy:
long size = long.MaxValue;
//method that may or may not set
//size
int[] array = new int[size];
Apparently we are processing blu-ray movies in place in memory.
rant