BUG in 3.6.0 ?
#10
(04-07-2023, 03:05 PM)DSMan195276 Wrote: 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 Smile 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
qbs
structure 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.

Thanks for this explanation.

For myself I have an easy work-around (fixed string array *200 bytes), so no worries there.

But it would be nice and improved quality if it gets fixed (or at least a gracefull error-exit) someday...
45y and 2M lines of MBASIC>BASICA>QBASIC>QBX>QB64 experience
Reply


Messages In This Thread
BUG in 3.6.0 ? - by mdijkens - 04-07-2023, 09:41 AM
RE: BUG in 3.6.0 ? - by Jack - 04-07-2023, 12:29 PM
RE: BUG in 3.6.0 ? - by mdijkens - 04-07-2023, 01:56 PM
RE: BUG in 3.6.0 ? - by mnrvovrfc - 04-07-2023, 01:00 PM
RE: BUG in 3.6.0 ? - by mdijkens - 04-07-2023, 02:01 PM
RE: BUG in 3.6.0 ? - by mnrvovrfc - 04-07-2023, 01:05 PM
RE: BUG in 3.6.0 ? - by bplus - 04-07-2023, 02:08 PM
RE: BUG in 3.6.0 ? - by mdijkens - 04-07-2023, 02:17 PM
RE: BUG in 3.6.0 ? - by DSMan195276 - 04-07-2023, 03:05 PM
RE: BUG in 3.6.0 ? - by mdijkens - 04-07-2023, 04:38 PM



Users browsing this thread: 8 Guest(s)