Arrays are one of the most basic data structures. They’re a primitive in nearly every language. In languages like C, they’re low level structures, which represent direct access to memory.
Wally’s co-worker, Brandon, wrote an array declaration:
#define GRID_X 256 #define GRID_Y 256 #define GRID_ENTRY 1024 char stations[GRID_X][GRID_Y][GRID_ENTRY];
Multiply those together, and you’ll see a 3D array with 67,108,864 characters. That’s 64MB of memory, or 68MB if you manufacture HDDs. It’s a large chunk of memory to allocate all at once, and it’s probably a bad idea, but it’s not a WTF.
It depends on what the array is used for. In this case, it needs to hold some data from a simple database loaded from a flash drive. How much data is in that database? 10KB, which means this is roughly like trying to kill a flea with an asteroid the size of Texas, but that still isn’t a complete WTF.
Wally works in embedded systems. Their code targets a stripped-down Linux distro, running on a small and well understood piece of hardware. That piece of hardware has only 32MB of RAM
.