Re: FAST_ARRAY and allocation
Dominique Colnet <[email protected]> Thu, 19 May 2005 11:36:12 +0200
| Newsgroups | gmane.comp.lang.eiffel.smalleiffel |
|---|---|
| Message-ID | <[email protected]> |
j-c.taveau wrote:
> I was wondering if there is a way to avoid a crash with 'No
> more memory' message when the memory allocation of a
> FAST_ARRAY is too large. I tried to catch an exception with
> 'rescue' unsuccessfully.
I have just tried (look the attached file).
At run time, i get:
$ compile xx
$ ./a.out
No more memory: the stack trace may be truncated.
size = 268435456
$ compile -boost xx
$ ./a.out
size = 268435456
So, at least on my example, everything is ok.
> Thanking you in advance,
>
> Jean-Christophe Taveau.
Hope this help,
--
--------------------------------------------------------------
[email protected] -- IUT (Nancy 2) -- INRIA Lorraine
http://SmartEiffel.loria.fr -- The GNU Eiffel Compiler
POST: Loria, B.P. 239,54506 Vandoeuvre les Nancy Cedex, FRANCE
Voice:+33 0383913140 Mobile: +33 0665362381 Fax:+33 0383581701
xx.e
(text/plain, 396 B)
class XX
creation {ANY}
make
feature {ANY}
make is
local
rescue_flag: BOOLEAN; size: INTEGER; big_one: FAST_ARRAY[INTEGER]
do
if rescue_flag then
io.put_string("size = " + size.to_string + "%N")
else
from
size := 1
until
False
loop
size := size * 2
create big_one.make(size)
end
end
rescue
rescue_flag := True
retry
end
end