Comment

Comment by jeffbee

That is incorrect. If I call std::vector<int>::reserve(1<<30) on Linux w/ GNU standard library, using the GNU default allocator, memory is lazily allocated:

  $ ./1
  allocating 4294967296 bytes
  ^Z
  [1]+  Stopped                 ./1
  $ grep -E VmSize\|RssAnon /proc/$!/status
  VmSize:  4199804 kB
  RssAnon:             144 kB
parent jeffbee 5 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton