1. Re: Rob: Out of memory + broken shorthand assignment operators in expressio
- Posted by Vincent <darkvincentdude at yahoo.com> Nov 18, 2005
- 505 views
- Last edited Nov 19, 2005
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 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. > > Regards, > Rob Craig > Rapid Deployment Software > <a href="http://www.RapidEuphoria.com">http://www.RapidEuphoria.com</a> Regards, Vincent