From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,XPRIO autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,126b9ecb088e6bfd,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-12 00:37:07 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!proxad.net!feeder2-1.proxad.net!news1-1.free.fr!not-for-mail From: "Alex Xela" Newsgroups: comp.lang.ada Subject: using 'storage_size ? Date: Sun, 12 Oct 2003 09:37:29 +0200 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2720.3000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2727.1300 Message-ID: <3f8904a1$0$10406$626a54ce@news.free.fr> Organization: Guest of ProXad - France NNTP-Posting-Date: 12 Oct 2003 09:37:05 MEST NNTP-Posting-Host: 81.56.190.34 X-Trace: 1065944225 news1-1.free.fr 10406 81.56.190.34:3598 X-Complaints-To: abuse@proxad.net Xref: archiver1.google.com comp.lang.ada:714 Date: 2003-10-12T09:37:05+02:00 List-Id: When the line 20 of the following code is uncommented the program raises a Storage_Error with GNAT3.15p under W2k. If I did not make a mistake, I reclaim for 5Mo at line 23. This is confusing me????? --------------- with ada.text_io,Unchecked_Deallocation,Ada.Exceptions; procedure garbage is ko : constant := 1024; Mo : constant := ko*ko; type byte is range 0..255; for Byte'size use 8; type tab_byte is array(positive range <>) of byte; pragma pack(tab_byte); type ptr_Tab is access tab_byte; ptr1,ptr2 : ptr_tab; procedure free is new Unchecked_Deallocation(Object=>tab_byte,name=>ptr_tab); begin ada.text_io.put_line(" Garbage : begin "); for i in 1..10 loop ptr1 := new tab_byte'(positive'first..5*Mo=>255); end loop; ptr2 := new tab_byte'(positive'first..5*Mo=>255); ada.text_io.put_line(" Ptr2.all'size ->"&integer'image(ptr2.all'size/(mo*8))&" Mo"); ada.text_io.put_line(" Ptr1.all'size ->"&integer'image(ptr1.all'size/(mo*8))&" Mo"); declare type local_ptr is access tab_byte; for local_ptr'storage_size use Mo*8;--[line 20]GNAT 3.15p raised STORAGE_ERROR : EXCEPTION_STACK_OVERFLOW ptr3 : local_ptr; begin ptr3 := new tab_byte'(positive'first..5*Mo=>255);--line 23 ada.text_io.put_line(" Ptr3.all'size ->"&integer'image(ptr3.all'size/(mo*8))&" Mo"); end ; free(ptr1); free(ptr2); ada.text_io.put_line(" Garbage : end "); end garbage;