home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.rexx
- Path: sparky!uunet!mcsun!sunic!ugle.unit.no!ugle!anders
- From: anders@lise1.lise.unit.no (Anders Christensen)
- Subject: Re: regina bug with very long strings
- In-Reply-To: SEB1525@MVS.draper.com's message of Tue, 8 Sep 1992 22:02:00 GMT
- Message-ID: <ANDERS.92Sep9155854@lise1.lise.unit.no>
- Sender: news@ugle.unit.no (NetNews Administrator)
- Organization: University of Trondheim, Norway
- References: <19920908170207SEB1525@MVS.draper.com>
- Date: 9 Sep 92 15:58:53
- Lines: 48
-
- In article <19920908170207SEB1525@MVS.draper.com> SEB1525@MVS.draper.com (Steve Bacher) writes:
-
- > There appears to be a bug in Regina 0.03d with long strings.
- > [...]
- > I get a segmentation fault. Where exactly the fault occurs depends on
- > if I run the SunOS version or the AIX version.
-
- The length of strings in Regina 0.03d is bounded by the size of an
- (signed) short in C, which is at least 32k (on Crays it's 16384 Tera).
- At least it ought to be unsigned short, which enables lengths of at
- least 64k. If you change two lines in string.h (change the only two
- references of 'short' to 'int') it will work for strings up to 2G.
-
- > Shouldn't Regina recover more gracefully from attempts to create a
- > string longer than the maximum value it can handle?
-
- Yes, it should.
-
- > Is this maximum
- > value documented, anyhow?
-
- I have been searching for the implementation minimum length of values in
- variables, but I didn't find it (I seem to remember having read 50000
- somewhere, but I don't know where).
-
- TRL 2nd ed states that variable values can have any length (5th
- section), but 2nd section states that the limit of length of variable
- values should be "much larger" than 50 characters. This is rather
- unspecified (and even a contradiction IMHO), does anyone else know
- more about this?
-
- > It would be less painful if the length of a
- > string were held as an int rather than a short (see src/strings.h).
-
- Yes. Using ints instead of shorts eats on an average 4 bytes more pr
- string. If you can live with that, apply the changes I outlined above.
- It still doesn't detect too long strings, but if you should happen to
- need strings bigger than 2 GB, then I think you are going to crash
- into practical limits for virtual memory long before that.
-
- Using unsigned int will set the limit to 4GB, but the difference is
- hardly of any practical significance.
-
- There is another problem, in some cases it doesn't sense allocations
- of more memory than is available. I have fixed that, and it will be
- available in the next version of Regina.
-
- -anders
-