Path: csiph.com!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Paul Edwards Newsgroups: comp.os.os2.programmer.misc Subject: Re: limit Date: Thu, 14 Mar 2024 09:07:56 +0800 Organization: A noiseless patient Spider Lines: 101 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 14 Mar 2024 01:07:59 -0000 (UTC) Injection-Info: dont-email.me; posting-host="dacb2b74ad40274da21d0f6a243efb58"; logging-data="1317427"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/5uA9AXri+j4lGORyq7yA5rxmw6S4WqiM=" User-Agent: Mozilla/5.0 (OS/2; Warp 4.5; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 Cancel-Lock: sha1:yE8yxU73mtw2Ky9FiXGtCw5QxuA= In-Reply-To: Xref: csiph.com comp.os.os2.programmer.misc:1910 On 14/03/24 06:13, Dave Yeo wrote: >> I see that DS has a limit of 5fff ffff which is basically 1.5 GB. >> >> But I thought without OBJ_ANY I got 512 MiB max, and >> with OBJ_ANY I could potentially access 4 GiB. >> >> So where is that limit coming from? > > What is your VIRTUALADDRESSLIMIT in config.sys set to? ArcaOS defaults > to 1536 or similar, maximum is 3072 though some hardware doesn't like > that as it can interfere with PCI space, eg video memory. Should be a > number that ends in 00 in hex. Thanks for that - spot on! [C:\]grep VIR config.sys VIRTUALADDRESSLIMIT=1536 Next issue. I was surprised to be running out of memory when doing this: [P:\devel\gcc\gcc\xxx]type temp.cmd \dos\pdas --oformat coff -o c-common.o c-common.s [P:\devel\gcc\gcc\xxx] When I added the "requesting" debug I got this: requesting 32 bytes, total 636279, attempts 7394 requesting 44 bytes, total 636323, attempts 7395 requesting 44 bytes, total 636367, attempts 7396 stdlib reports alloc failure \dos\pdas: error: memory full (malloc) But without the debug, I didn't get that "alloc failure" message. Instead I got an OS/2 popup saying I was short of unspecified resources. Now I thought there was a limit of 512 MB by default, but there is an actual OBJ_TILE flag to DosAllocMem to restrict it to that it seems. And a different flag for OBJ_ANY. Which means the default is what? Now I know it is not ideal to call DosAllocMem for every memory allocation requested and I should use a heap manager (I actually have one (memmgr), but I prefer not to use it, for simplicity). Even with 4k granularity, there are less than 8000 requests, so that's 32 MB additional overhead, on top of ... less than 1 MB. So I suspect there is a limit of around 8000 separate requests. I'm guessing this is to keep within the limit of 80386 selectors so that someone may request this memory to be converted to 16:16 Anyway, adding OBJ_ANY allowed the memory requests to continue: requesting 6152 bytes, total 849766, attempts 10683 requesting 40 bytes, total 849806, attempts 10684 requesting 40 bytes, total 849846, attempts 10685 requesting 40 bytes, total 849886, attempts 10686 And I didn't experience any issues with DosWrite etc either. From memory it is DosOpen that has the issue, not DosWrite. And so long as my executable is loaded below 512 MiB - which is under OS/2 control - I shouldn't have any issue with parameters to DosOpen being above the 512 MiB line. Well - the second parameter could potentially be in high memory, but that would be an unlikely, but I guess not impossible, thing to be internally mapped to 16:16. rc = DosOpen((PSZ)fnm, &myfile->hfile, &action, newsize, fileAttr, openAction, openMode, (ULONG)0); But for now, it works, and with this problem fixed or circumvented, I should be up and running soon. BFN. Paul.