04-07-2023, 03:05 PM
I think you're likely hitting an issue I noticed a few months ago, see here. Basically there's a single buffer backing all the variable length strings and it's size is a 32-bit number (even on 64-bit systems) so it can overflow, crashing your program when that happens. Additionally, because the overflow condition is not checked for there's no error given.
Personally I'd like to redo all that logic, but it's probably not all that hard to just fix the issue. Since nobody else had noticed it I didn't put it high on the list of things to do though Why it works in older versions is hard to say as we haven't touched any of that logic (yet), but the issue is a bit random since it depends on the order you create the strings in and what size they are and such. I think you're also right on the edge of the "supported" size.
Also note that only variable length strings suffer this problem, fixed length strings and _MEM work fine. For such small strings (50 to 200 bytes) if you're filling all of them in then you're probably not saving yourself a whole lot of memory by using variable length strings anyway. The internal
Personally I'd like to redo all that logic, but it's probably not all that hard to just fix the issue. Since nobody else had noticed it I didn't put it high on the list of things to do though Why it works in older versions is hard to say as we haven't touched any of that logic (yet), but the issue is a bit random since it depends on the order you create the strings in and what size they are and such. I think you're also right on the edge of the "supported" size.
Also note that only variable length strings suffer this problem, fixed length strings and _MEM work fine. For such small strings (50 to 200 bytes) if you're filling all of them in then you're probably not saving yourself a whole lot of memory by using variable length strings anyway. The internal
qbsstructure that holds the information on a variable length string is between 30 to 50 bytes in size, so that's 30 to 50 bytes of extra overhead for each string in your array in addition to the actual string data. Fixed length strings in comparison only consist of the backing data itself. You still might come out a bit ahead with the variable length strings, but not by as much, and if the majority of your strings are in the 150 to 200 byte range then it might actually be worse.