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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!backlog2.nntp.dca.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail NNTP-Posting-Date: Mon, 11 May 2009 18:30:20 -0500 From: Brian Drummond Newsgroups: comp.lang.ada Subject: Re: Allocation question Date: Tue, 12 May 2009 00:32:50 +0100 Reply-To: brian@shapes.demon.co.uk Message-ID: <2sch05hgid94qq7d47ip8pamh8987k1eat@4ax.com> References: <4a07fc7a$0$2855$ba620e4c@news.skynet.be> X-Newsreader: Forte Agent 1.7/32.534 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-Syy5ECVAy/vXmu3XsZxir+hwiWQxRHclj80Bkf0coNs7wwP4KyizCtLG/dyuXM4uq9BmZT2r+DVWrNq!1z8TjGJlDxB0635LEwSLnCgyDf9SSwUqSeOsezK7zf410XLYGrD/0WqzWPROew/HsOzy+SrV6slX!6Da36XxMJrjIIA/s X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.39 X-Original-Bytes: 2243 Xref: g2news2.google.com comp.lang.ada:5773 Date: 2009-05-12T00:32:50+01:00 List-Id: On Mon, 11 May 2009 12:23:11 +0200, Olivier Scalbert wrote: >Hello, > >I have write a small package: > >--------------------------------------------------- >-- ads >--------------------------------------------------- >package Image is ... >with Image; >use Image; > >procedure Test_Image is > Image : Image_T(1..100, 1..100); > FillColor : constant Color_T := (0, 0, 0); >begin > Fill(Image, FillColor); >end Test_Image; > > >This program seems to work. >However when I increase the size of Image, I get a Segmentation fault. > >Should I need to play with access type and allocation stuff ? One simple approach is to use an access type for allocation, but use renaming to maintain compatibility with what you've already written. procedure Test_Image is Image_a : access Image_t := new Image_T(1..1024, 1..1024); Image : Image_t renames Image_a.all; FillColor : constant Color_T := (0, 0, 0); begin Fill(Image, FillColor); end Test_Image; I am not in front of an Ada compiler right now so the syntax may be slightly off, but I hope the basic idea is clear - Brian