Comment

Comment by Steven_Vellon

Is it not possible to keep allocating contiguous memory? Just keep appending to the string and allocating more memory. Repeated calls to malloc are not guaranteed to be contiguous but I think you can do this with posix_memalign. Just keep growing the heap segment, and appending more character to it. I suppose it's not going to be contiguous in physical memory, but it should in virtual memory.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton