[comp.os.os2.misc] near heap space

nacer@hpmcaa.mcm.hp.com (Abdenacer Moussaoui) (07/20/90)

Where is this switch /B1 documented  I cannot find it in the User''s Guide/
Language Ref. binder?

slh@fred.cs.washington.edu (Scott Heyano) (07/20/90)

In article <1990Jul19.003747.18984@murdoch.acc.Virginia.EDU> tg2r@dale.acc.Virginia.EDU (Todd Greenwald) writes:
>As my pm programs increase in size, I'm increasingly encountering
>a compile error "out of near heap space".  I'm using the IBMc2
>compiler.  Has anyone encountered this and found a fix.  (I've
>discovered some interesting solutions; like removing INCL_WIN when
>there were no Win calls being made.)
>Thanks
>Todd Greenwald

Making the source smaller is the solution.
And by including fewer header files or less header file (I'm not sure which
counts exactly), that is what you are doing.
Also, of course, if your program is getting large, break it into smaller files.

I've run into the problem when with a source that was only about
500 lines long, but included alot of win and gpi stuff and I had to move
the code with the gpi calls to another file.
This really pissed me off since it was such a small source file.

markha@microsoft.UUCP (Mark HAHN) (07/21/90)

the crude solution is certainly to use the large-model version of
the compiler's first pass.  it is a lot slower, though.  my preference
is to use just the specific INCL flags that you need.  for instance,
if you use WinCreateDlg(), you need "#define INCL_WINDIALOGS" to get
the prototypes, etc.  You can do this with "base" stuff as well,
the Dos and subsystem functions.  read those headers!

regards,
-- 
Mark Hahn         microsoft!markha@uunet.uu.net         uunet!microsoft!markha
YES, Bill Gates IS my personal savior, and I CHANNEL for him in CLEAR WEATHER.

gregj@microsoft.UUCP (Greg JONES) (07/25/90)

In article <12599@june.cs.washington.edu>, slh@fred.cs.washington.edu (Scott Heyano) writes:
> In article <1990Jul19.003747.18984@murdoch.acc.Virginia.EDU> tg2r@dale.acc.Virginia.EDU (Todd Greenwald) writes:
> >As my pm programs increase in size, I'm increasingly encountering
> >a compile error "out of near heap space".  I'm using the IBMc2
> >compiler.  Has anyone encountered this and found a fix.  (I've
> >discovered some interesting solutions; like removing INCL_WIN when
> >there were no Win calls being made.)
> 
> Making the source smaller is the solution.
> And by including fewer header files or less header file (I'm not sure which
> counts exactly), 

Amount of heap space used for symbols is the problem.  So it depends
on what the header files define.  Presumably (I'm a net guy, not a
language guy) #define's don't contribute, but typedef's and function
prototypes do.

I find the best candidate is usually changing #define INCL_GPI to
INCL_GPIPRIMITIVES if you use some simple GPI stuff (like GpiErase)
but don't get into anything more complex.  pmgpi.h defines a LOT of
symbols.

uunet!microsof!gregj
[I just happen to work here.  Sheer coincidence.]

sadler@hsinchu.sw.mcc.com (Rob Sadler) (07/25/90)

modules.  When I called Microsoft they told me about an undocumented compiler
switch -B1 (bee one) that allowed you to specify the name of the first pass
parser which should be c1L.exe (the *large* memory model first pass parser).
So by adding this to my compile line I have never had the problem again.
I do not know if the IBMc2 compiler supports this but it may if it's a rewrap
of the MS product.  The problem is that the compiler itself has only one 
segment (64K) allocated for its own heap to use while parsing your code. 
 The c1L.exe parser is not the default but it is smart enough to know how
to get multiple heaps.



-- 
| Robert F. Sadler                                     |  rob.sadler@mcc.com  |
| MCC/STP                                              |    (512) 338-3603    |
| 3500 West Balcones Center Drive                      |       N C R          |
| Austin, Texas  78759-6509                            |                      |