LoadStartupFile allocates file size + 1, reads the whole file, null-terminates it, then calls SetWindowTextA. That means during load you temporarily have at least two copies...your heap buffer and the edit control’s internal buffer.
Same issue in SaveFile: it asks the edit control for the entire text length, allocates a buffer, copies all text into it, then writes it.
This matters a lot for large files. A 50 MB file currently needs a temporary 50 MB buffer on top of the control’s own storage. Streaming reduces peak memory drastically.
LoadStartupFile allocates file size + 1, reads the whole file, null-terminates it, then calls SetWindowTextA. That means during load you temporarily have at least two copies...your heap buffer and the edit control’s internal buffer.
Same issue in SaveFile: it asks the edit control for the entire text length, allocates a buffer, copies all text into it, then writes it.
This matters a lot for large files. A 50 MB file currently needs a temporary 50 MB buffer on top of the control’s own storage. Streaming reduces peak memory drastically.