String limitations 
Author Message
 String limitations

Hello,

I keep running into memory problems when I use large strings, e.g.:

DIM A$(900)
DIM M(900,6)
etc

For some reason this doesn't immediately take away too much for either
GW-BASIC or QBASIC:

print fre(0)

32xxx left

So that's, what 28KB in strings?

But then when I load in a large file with 900 strings of 255 characters each, the stupid program reads through half of them
and then dies with an Out of String Space or Out of Memory error. Why does this occur, if I setup 28KB of strings anyway?

Wouldn't 28KB of string space be enough to hold 900 lines of text, with each being 255 characters long? Am I brain dead, or am
I just not understanding how much space is being set aside by DIMensioning these variables?

Regards,

Dunric

--
--
********************************************************************************

          Few cats act their age, while most just cough up fur balls.

********************************************************************************



Wed, 26 Mar 2003 03:00:00 GMT  
 String limitations

Quote:

> Hello,

> I keep running into memory problems when I use large strings, e.g.:

> DIM A$(900)
> DIM M(900,6)
> etc

> For some reason this doesn't immediately take away too much for either
> GW-BASIC or QBASIC:

> print fre(0)

> 32xxx left

> So that's, what 28KB in strings?

> But then when I load in a large file with 900 strings of 255 characters each, the stupid program reads through half of them
> and then dies with an Out of String Space or Out of Memory error. Why does this occur, if I setup 28KB of strings anyway?

> Wouldn't 28KB of string space be enough to hold 900 lines of text, with each being 255 characters long? Am I brain dead, or am

Lets see,  900 * 255 = 229,500  (224KB).  On my planet,   229,500 > 28,672 ( 28KB)

I wouldn't go so far as to say you're brain dead, maybe just not paying close enough attention
to the details.  Hope that helps ...

- Show quoted text -

Quote:
> I just not understanding how much space is being set aside by DIMensioning these variables?

> Regards,

> Dunric

> --
> --
> ********************************************************************************

>           Few cats act their age, while most just cough up fur balls.

> ********************************************************************************



Fri, 28 Mar 2003 03:00:00 GMT  
 String limitations


Quote:
> Hello,

> I keep running into memory problems when I use large strings, e.g.:

> DIM A$(900)
> DIM M(900,6)
> etc

> For some reason this doesn't immediately take away too much for either
> GW-BASIC or QBASIC:

> print fre(0)

> 32xxx left

> So that's, what 28KB in strings?

> But then when I load in a large file with 900 strings of 255

characters each, the stupid program reads through half of them
Quote:
> and then dies with an Out of String Space or Out of Memory error. Why

does this occur, if I setup 28KB of strings anyway?
Quote:

> Wouldn't 28KB of string space be enough to hold 900 lines of text,

with each being 255 characters long? Am I brain dead, or am
Quote:
> I just not understanding how much space is being set aside by

DIMensioning these variables?
Quote:

> Regards,

> Dunric

> --
> --

************************************************************************
********
Quote:

>           Few cats act their age, while most just cough up fur balls.

************************************************************************
********
Ever heard of "Dynamic allocation"? This means, if you dimension a
string, say a$(100), you don't allocate 255*100=25,500 bytes right
away. You allocate 100 null strings (empty strings), which probably in
GW-BASIC would allocate 100 length bytes in a symbol table. So you
might use 100 bytes plus whatever space the symbol table would require,
which may not be in the same memory space. As you fill each string, it
allocates more space, adjusting the length bytes and pointers to each
string.

Sent via Deja.com http://www.deja.com/
Before you buy.



Sat, 29 Mar 2003 03:00:00 GMT  
 String limitations
Hi all!
The place for dynamic length strings is 64K in any falvour of MS basic
for DOS, so you can
DIM a$(900)
but if the total length of all strings exceeds 64K MINUS The stack MINUS
other static variables you're in trouble

QBasic has also a 64K size limit for any KIND OF ARRAY array
But QuickBasic 4.5 loaded with /ah does'nt have this limit for arrays in
the heap,so i have tried

REDIM A(900) AS STRING *256

and it worked!
Curiously

REDIM A(900) AS STRING *255

did'nt worked!!! Some problem with segment boundaries, I imagine

I hope it helps
Antoni

Quote:

> Hello,

> I keep running into memory problems when I use large strings, e.g.:

> DIM A$(900)
> DIM M(900,6)
> etc



Sun, 30 Mar 2003 03:00:00 GMT  
 String limitations


Quote:
>Hi all!
>The place for dynamic length strings is 64K in any falvour of MS basic
>for DOS, so you can
>DIM a$(900)
>but if the total length of all strings exceeds 64K MINUS The stack MINUS
>other static variables you're in trouble

>QBasic has also a 64K size limit for any KIND OF ARRAY array
>But QuickBasic 4.5 loaded with /ah does'nt have this limit for arrays in
>the heap,so i have tried

>REDIM A(900) AS STRING *256

>and it worked!
>Curiously

>REDIM A(900) AS STRING *255

>did'nt worked!!! Some problem with segment boundaries, I imagine

Arrays > 128k must have an element size that is of a power of 2.
It's in the FM somewhere, as RTFM.

 --
arargh   (at enteract period com)             http://www.arargh.com
(Reply address points nowhere in an attempt to foil e-mail spammers.)



Sun, 30 Mar 2003 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. 64K string limitation

2. 64K string limitation problem

3. HELP 64K String limitation

4. string limitation

5. ADO String Limitation.

6. Strings limitation ?

7. String length limitation?

8. String Length Limitation Workaround?

9. 32k String & Text Box Limitation

10. string length limitation?

11. Limitation on HTTP string length?

12. How to work arround the limitation of string fields

 

 
Powered by phpBB® Forum Software