Logo
Documentation: A love letter to your future self.
  • Home
  • Hot
  • Random
  • Search

Browse

  • AI AI
  • AWS AWS
  • Agile Agile
  • Algorithms Algorithms
  • Android Android
  • Apple Apple
  • Azure Azure
  • Backend Backend
  • Bash Bash
  • C++ C++
  • Cloud Cloud
  • All Categories
As an Amazon Associate ProgrammerHumor.io earns from qualifying purchases.

HTTP 418: I'm a teapot

The server identifies as a teapot now and is on a tea break, brb

HTTP 418: I'm a teapot

The server identifies as a teapot now and is on a tea break, brb

Realloc Memes

Posts tagged with Realloc

Possibly The Worst Way To Read A File In C

Programming Debugging C++ Algorithms
1 year ago 402.1K views 0 shares
Possibly The Worst Way To Read A File In C
This code is the programming equivalent of filling a bathtub one teaspoon at a time while expanding the bathtub after each spoon. 😱 Instead of reading the file in chunks or pre-allocating memory, this monster allocates exactly ONE byte, reads ONE character, reallocates the ENTIRE array, and repeats for EVERY SINGLE CHARACTER. The malloc/realloc combo is basically begging the memory manager to have a nervous breakdown. The performance would be so catastrophically bad that you could probably go make a sandwich between reading "Hello" and "World". It's like watching someone solve a maze by rebuilding the entire universe after each step.

Today's picks

Sony WH-1000XM6 The Best Noise Cancelling Wireless Headphones, Sandstone

Sony WH-1000XM6 The Best Noise Cancelling Wireless Headphones, Sandstone

Affiliate
$459.99
Power Surge Incoming

Power Surge Incoming

Java
312.8K views 1 year ago
NordVPN

NordVPN

Sponsored
VPN