Article View: comp.os.ms-windows.programmer.misc
Article #2618Re: Automatic data segment exceeds 64K
From: Chris Marriott
Date: Fri, 08 Jan 1993 19:13
Date: Fri, 08 Jan 1993 19:13
38 lines
2222 bytes
2222 bytes
In article <C0IGp6.777@world.std.com> pbreen@world.std.com writes:
>"Jeffrey P. Overcash" <p00090@mail.psi.net> writes:
>
> [ stuff deleted]
>If these don't help, the space is probably being taken up by a few static
>arrays or structures. If it is possible to change these to be allocated
>from the heap, the problem may go away. If it is not possible to allocate
>them from the heap, you can force them to be put into a far segment by
>including the _far keyword in the declaration - for instance
>
>static long _far LargeArray[1000] = { 1, 2, ... 1000, };
>
>The one thing to watch for with this is that by default, Borland will
>create a new far segment for each declaration of this type. There is a
>compile switch (and a #pragma) that force them all into the same far
>segment but I forget what the switch is.
>
>Hope this helps,
>
>Patrick Breen
>
The problem with doing this, though, is that the presence of FAR data makes
the application single instance only. There's no way around this.
If you have global arrays, it's better to replace it with a global pointer,
and "GlobalAlloc" the actual memory. If you need to store lots of static
data for initialization, store it in the resource file and read it in at
run-time.
--
--------------------------------------------------------------------------
| Chris Marriott | chris@chrism.demon.co.uk |
| Warrington, UK | BIX: cmarriott |
| (Still awaiting inspiration | CIX: cmarriott |
| for a witty .sig .... ) | CompuServe: 100113,1140 |
--------------------------------------------------------------------------
Technical Details
Message-ID:
<726520419snz@chrism.demon.co.uk>Path:
arc1-ca.pugleaf.net!sparky!uunet!pipex!demon!chrism.demon.co.uk!chrisReferences:
<C0IGp6.777@world.std.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.os.ms-windows.programmer.misc From: chris@chrism.demon.co.uk (Chris Marriott) Path: arc1-ca.pugleaf.net!sparky!uunet!pipex!demon!chrism.demon.co.uk!chris Subject: Re: Automatic data segment exceeds 64K Distribution: world References: <C0IGp6.777@world.std.com> Organization: None Reply-To: chris@chrism.demon.co.uk X-Mailer: Simple NEWS 1.90 (ka9q DIS 1.19) Lines: 38 Date: Fri, 8 Jan 1993 19:13:39 +0000 Message-ID: <726520419snz@chrism.demon.co.uk> Sender: usenet@demon.co.uk