QB64-Phoenix-Edition / QB64pe

The QB64 Phoenix Edition Repository
https://qb64phoenix.com
Other
132 stars 26 forks source link

memory-leak / corruption with large string assignments #559

Open mdijkens opened 1 month ago

mdijkens commented 1 month ago

Describe the bug When (re)assigning a string variable with a large string (>1GB) after a few times program crashes

To Reproduce Steps to reproduce the behavior: c$=space$(1123123123) c$=space$(1123123123) c$=space$(1123123123) c$=space$(1123123123) c$=space$(1123123123) c$=space$(1123123123) c$=space$(1123123123)

Expected behavior Program ends/continues normally

Screenshots Program just aborts/killed

Desktop (please complete the following information):

Additional context Ran into issue with c$=ReadFile$() reading multiple large files in a loop

mdijkens commented 1 month ago

See also https://qb64phoenix.com/forum/showthread.php?tid=3130

mkilgore commented 1 month ago

The underlying issue is already reported here: https://github.com/QB64-Phoenix-Edition/QB64pe/issues/278

But note that due to how the string buffer is handled you'll need almost twice the total memory for the strings you create (so if you want to make 32GB of strings, you need around 64GB of total memory). Really, to be able to handle that much data the qbs string logic needs to be significantly improved.