Mailing List Archive

twofish eats a LOT of memory
When compiling twofish.c I get this.

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I../intl -I../intl -O2
-Wall -shared -fPIC -o twofish twofish.c
twofish.c: In function `twofish_setkey':
twofish.c:580: virtual memory exhausted
make: *** [twofish] Error 1

I have 32 MB ram and 32 MB swap, I run Linux 2.1.115 and egcs 1.0.2. The
problem was solved by using -O instead of -O2.
Re: twofish eats a LOT of memory [ In reply to ]
On Tue, 11 Aug 1998, Thomas Mikkelsen wrote:
> I have 32 MB ram and 32 MB swap, I run Linux 2.1.115 and egcs 1.0.2. The
> problem was solved by using -O instead of -O2.

This is interesting, because it compiled without running out of virtual
memory on my 486 running Linux 2.0.30, with only 16M of RAM and 32M of
swap. However, it took about a half hour to compile. The resulting code
ran with no detectable speed increase over the code with optimization
turned off; as a result, I don't recommend turning optimization on for
that file. The code is heavily hand-optimized - if you look at the
source, you'll find I've unrolled all the loops and so on. I think the
optimizer probably chokes trying to further optimize it.

I don't know if it's easy to do in the context of the automatic
configuration system, but maybe the makefile should turn optimization off
for this one file. (Alternatively, I or someone else could re-write the
file to "un-optimize" it, but that seems like a bad idea...)

"Let me lose so beautifully http://www.islandnet.com/~mskala/
Let me lick the dew from the money tree Matthew Skala
Have the moms of the world all care about me Ansuz BBS
At suppertime" - Odds (250) 472-3169
Re: twofish eats a LOT of memory [ In reply to ]
Thomas Mikkelsen <tbm@image.dk> writes:

> twofish.c: In function `twofish_setkey':
> twofish.c:580: virtual memory exhausted
> make: *** [twofish] Error 1
>
> I have 32 MB ram and 32 MB swap, I run Linux 2.1.115 and egcs 1.0.2. The
> problem was solved by using -O instead of -O2.

I have the same problem with egcs 1.0.3a -Try gcc or better remove -O2
as you gain no better performance - I should do this in the Makefile.



Werner