Re: Rob: Out of memory + broken shorthand assignment operators in expressions
- Posted by Robert Craig <rds at RapidEuphoria.com> Nov 18, 2005
- 456 views
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. > 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. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com