From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.0 required=3.0 tests=BAYES_20,FREEMAIL_FROM, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Received: by 2002:a05:622a:4389:b0:3a5:46b0:ffec with SMTP id em9-20020a05622a438900b003a546b0ffecmr1067209qtb.306.1674456998616; Sun, 22 Jan 2023 22:56:38 -0800 (PST) X-Received: by 2002:a05:6808:98b:b0:35b:e9c5:24f7 with SMTP id a11-20020a056808098b00b0035be9c524f7mr1340073oic.171.1674456998394; Sun, 22 Jan 2023 22:56:38 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!border-1.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 22 Jan 2023 22:56:38 -0800 (PST) In-Reply-To: Injection-Info: google-groups.googlegroups.com; posting-host=157.143.56.236; posting-account=Wbe3fAoAAAALa8UT9MWTy6mw2ahlRJms NNTP-Posting-Host: 157.143.56.236 References: <9c7cccd9-733f-49a8-b482-087ccb14b58dn@googlegroups.com> <2039b788-bbbd-4c8e-9785-4e45d4a2027en@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <8a053ff6-ce49-454e-8304-9c2a25a665e8n@googlegroups.com> Subject: Re: Real_Arrays on heap with overloaded operators and clean syntax From: Jim Paloander Injection-Date: Mon, 23 Jan 2023 06:56:38 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader01.eternal-september.org comp.lang.ada:64865 List-Id: > >>>> Dear ADA lovers,=20 > >>>> with stack allocation of Real_Vector ( 1 .. N ) when N >=3D 100,000 = I=20 > >>>> get STACK_OVERFLOW ERROR while trying to check how fast operator=20 > >>>> overloading is working for an expression=20 > >>>>=20 > >>>> X :=3D A + B + C + C + A + B, where=20 > >>>> A,B,C,X are all Real_Vector ( 1 .. N ).=20 > >>>>=20 > >>>> So my only option was to allocate on the heap using new. But then I= =20 > >>>> lost the clean syntax=20 > >>>>=20 > >>>> X :=3D A + B + C + C + A + B=20 > >>>>=20 > >>>> and I had to write instead:=20 > >>>>=20 > >>>> X.all :=3D A.all + B.all + C.all + C.all + A.all + B.all.=20 > >>>>=20 > >>>> This is really ugly and annoying because when you are using=20 > >>>> Real_Arrays for implementing some linear algebra method who relies= =20 > >>>> heavilly on matrix vector products and vector updates, you do need= =20 > >>>> to allocate on the heap (sizes are determined in runtime) and you do= =20 > >>>> need a clean syntax. So, is there any way to simplify my life=20 > >>>> without using the .all or even without declaring A,B,C,X as access= =20 > >>>> Real_Vector?=20 > >>>> Thanks for your time!=20 > >>> If you are on linux, then you could set the stack size with=20 > >>>=20 > >>> $ ulimit -s unlimited=20 > >>> $ launch_my_app=20 > >>>=20 > >>>=20 > >>>=20 > >>> Regards.=20 > >> On Windows 10 with mingw64?=20 > >=20 > > Not sure. I don't have a windows machine.=20 > >=20 > > What happens when try ?=20 > >=20 > > $ ulimit -a > ulimit is available on cygwin.=20 >=20 > It is not available on mingw64 then ? It is, but I am not sure if it works since -D400m -d400m together with ulim= it were not able to solve the problem. So I thought that under windows 10 a= nd mingw things related to stack size settings are not equivalent to Linux.= I checked your repository. Looks good. We need some elegant solution, beca= use sometimes it is not easy to predict the stack size that will be needed.= Imagine you write a commercial application that is running from a GUI and = the user loads a particular case from a file. The memory that will be neede= d may even exceed the available memory installed on the computer. There mus= t be some elegant way to set the stack size globally. On the other hand sto= rage pool seem that does not need deallocation. Isnt there any storage pool= for stack based allocation so that you enjoy best of both worlds?