1. Rob: Out of memory + broken shorthand assignment operators in expressions

Bob Thompson wrote:
> 
> 
> Has anyone any ideas why the following programme works OK
> with a 1.47 GHz Athlon 1700+ processor, 512MB RAM and 0.75
> to 1.5 GB swap file, albeit with memory swapping for 7 mins,
> but runs out of memory with a Pentium (R) 4 CPU 4.39 GHz
> (Pentium 640 with hyperthreading and 2MB cache), 2GB RAM
> and 3 to 5 GB swap file when the loop number is 41441051?
> 
> Both have XP as operating system.
> 
> The Pentium box runs at maximum 50% CPU usage for a single
> thread application. If I run the programme a few times
> simultaneously, the Pentium peaks at 100% CPU usage and goes
> into memory swapping but each programme terminates at the same
> loop number.
> 
> Incidentally, with smaller loops (i.e no memory swapping), the
> Pentium's only 80% faster than the Athlon for this application.
> 
> --run as an .exw file
> atom t
> sequence s
> 
> s = {}
> 
> t = time()
> 
> for n = 1 to 200000000 do
> s = append(s, n)--sequence s needs 800000024 bytes
> end for
> 
> ?time() -t
> 
> machine_proc(26,0)
> 
> If I create more, say ten, shorter sequences within a single
> application instead of one long one, I can approach 2GB before
> it quits but I still run out of memory where the total number of
> bytes needed for all sequences is well short of total memory
> availability.
> 
> Is this a Windows or a Euphoria memory management issue, can I
> change any settings, or am I pushing the limits a little too
> high in this test?
> 
> Thanks in advance for any help,
> 
> Bob

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.

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:
-- 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

But...
-- 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


The same thing happens with -=, /=, *=, and 
&= (with sequences).


Regards,
Vincent

new topic     » topic index » view message » categorize

2. Re: Rob: Out of memory + broken shorthand assignment operators in expressions

Vincent wrote:
> 
> 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.

I don't think they fail to work.

If you code

   if x = x + 1 then...

Well, 'x' doesn't equal 'x + 1' so the condition fails.

And coding this:
> if i += 1 then
> end if

is like coding this:

if puts(1,"Hello") then...

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » goto parent     » topic index » view message » categorize

3. Re: Rob: Out of memory + broken shorthand assignment operators in expressions

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

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu