Re: Rob: Out of memory + broken shorthand assignment operators in expressio

new topic     » topic index » view thread      » older message » newer message

Vincent wrote:
> 
> Robert Craig wrote:
> > 
> > Vincent wrote:
> > > This is quite interesting because I've written small programs 
> > > simular to that, and Euphoria runs out of memory (every time) 
> > > at loop 141441051. I didnt think of reporting it, because I 
> > > thought my computer was running out of memory. Adjusting the 
> > > swap file size did nothing.
> > >
> > > My computer is a 2.66 GHz Pentium 4 Northwood 512 KB L2 cache; 
> > > 512 MB DDR SD-RAM @ 333 MHz; 512 MHz front-side bus; Windows XP 
> > > SP 2.
> > 
> > Hmm...  141441051 x 4 bytes per element = 565,764,204 bytes
> > which already exceeds your RAM. Plus where is the O/S
> > supposed to reside? Plus append() must sometimes make a full
> > copy of your sequence plus extra, when it moves the data 
> > to a new larger contiguous block.
> > 
> 
> But it crashes with the same value regardless if the swap file is 
> 2 GB or 4 GB. Doesn't Euphoria utilize the swap file when it uses 
> all the system memory? It could'nt have used all 4 GB of RAM+swap 
> file? The way your talking... if append() copied the sequence, 
> then maybe just a little more than 1 GB would be required.

I don't know much about the algorithm that the O/S uses when
handing out memory. It will give you some swap space, but it won't
necessarily hand you the whole thing.

> > > I discovered an issue that has to do with assignment operators 
> > > failing to work in conditional or loop expressions. My guess 
> > > is that this been a issue since they were introduced in 
> > > Euphoria v2.1.
> > > 
> > > For example:
> > > }}}
<eucode>
> > > -- this code runs
> > > integer i, f
> > > 
> > > i = 0
> > > f = 0
> > > 
> > > if i = i + 1 then
> > > end if
> > > 
> > > while f = f + 1 do
> > > end while
> > > 
> > > machine_proc(26,0) -- wait_key
> > > </eucode>
{{{

> > > But...
> > > }}}
<eucode>
> > > -- this code fails with an error
> > > integer i, f
> > > 
> > > i = 0
> > > f = 0
> > > 
> > > if i += 1 then
> > > end if
> > > 
> > > while f += 1 do
> > > end while
> > > 
> > > machine_proc(26,0) -- wait_key
> > > </eucode>
{{{

> > > 
> > > The same thing happens with -=, /=, *=, and 
> > > &= (with sequences).
> > 
> > f += 1 is not an expression. It's a statement.
> > That's why you get an error message.
> 
> I see... but I thought they both worked the same?
> I mean, 'i = i + 4' produces the same result as
> 'i += 4', etc.

i assigned i + 4 
is a statement, and is not the same as:
i equals i + 4
which is an expression.
"=" can mean "assigned" or "equals" depending on the context.
i += 4 is always a statement, never an expression.
(C is different)

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu