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,XPRIO autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,23ace43a488fab29,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newscon06.news.prodigy.com!newscon02.news.prodigy.com!prodigy.net!news.glorb.com!Spring.edu.tw!news.nctu.edu.tw!feeder.seed.net.tw!netnews!not-for-mail From: "bubble" Newsgroups: comp.lang.ada Subject: function "&" for strings type cause memory problem. Date: Thu, 10 Nov 2005 16:25:09 +0800 Organization: HiNetNews Message-ID: NNTP-Posting-Host: 211-21-128-195.hinet-ip.hinet.net X-Trace: netnews.hinet.net 1131611113 18013 211.21.128.195 (10 Nov 2005 08:25:13 GMT) X-Complaints-To: usenet@HiNetnews.hinet.net NNTP-Posting-Date: Thu, 10 Nov 2005 08:25:13 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 Xref: g2news1.google.com comp.lang.ada:6335 Date: 2005-11-10T16:25:09+08:00 List-Id: dear all: I have a project need mix 2 language (VB and Ada). VB do GUI and monitor the real time quote then trigger kernel work. Ada with gnatcom to do kernel work (financial model pricing). in the project, a code snip will raise storage_error excpeiton because I combine 2 BIG string to 1 string. I test the code snip and I get some problem in the statement, Nstring2 := new String'(String1 & String2) . if I compiling the code to stand alone execute file and enable pragma Linker_Options ("-Wl,--stack=0x10000000"); It both passed. if I compiling it to DLL ,it pass test 1 and fail in test2 Test 1 | Test 2 ----------------------------------------------------------------------------------------------- .exe with Linker_Options | Pass Pass .exe without Liner_Options | Pass Fail .dll with Linker_Options | Pass Fail .dll without Linker_Options | Pass Fail Test Environment ---------------------------------------------------------------------------------------------- OS:Windows XP. memory :640 MB. VB: Microsoft Visual Basic 6 gnatcom version: 1.4 ada compiler: Gnat GPL 2005 I guess functin "&" for string type may have potential problem in gnat windows editions. does any body know the problem and give me some suggestion. thanks Test Code -------------------------------------------------------------------------------------------------- with Ada.Text_IO; Use Ada.Text_Io; procedure test is --pragma Linker_Options ("-Wl,--stack=0x10000000"); type access_string is access all String; String1 : String := (1 .. 10_000_000 => 'a'); String2 : String := (1 .. 10_000_000 => 'b'); begin declare nString : access_string := null; begin nString:= new String (1 .. String1'Length + String2'Length); nString.all (String1'First .. String2'Last) := String1; nString.all ( String1'First + String2'First.. String1'First + String2'Last):= String2; Put_Line("Test 1 Passed"); Exception When Others=> Put_Line("Test 1 Fail"); end; declare Nstring2 : access_string := null; begin Nstring2 := new String'(String1 & String2); Put_Line("Test 2 Passed "); exception when others => Ada.Text_IO.Put_Line ("Test 2 Fail"); end; end test;