[CMake] Re: Fwd: /Zm1000 option in MSVC gives problems

Paul Richards paul.richards at gmail.com
Wed Jul 11 04:23:59 EDT 2007


According to the link I posted, this compile flag always fails on
machines with RAM + Swap >= 2Gb.  Are you sure that you can compile
VTK and ITK under VC6 on such a machine?

I think this option is telling the compiler how much memory it can go
up to.  In the case of there not being enough memory it happily
allocates something less.  I suspect this is what's happening on most
machines that use VC6 to compile VTK and ITK.

On machines which do have enough memory to allocate the amount we
request with this flag, the compiler naively attempts to do so and
runs out of virtual address space.

I believe that setting this flag to something lower (eg 750 or 600)
would see the effect you desire for compiling VTK and ITK and would
also fix the problem on >= 2Gb machines.


Can you tell me how to disable this flag in the CMakeLists.txt?  I
currently have local changes to my CMake build.  I know I could
override it with /Zm200, but I'd prefer to disable it completely.


On 10/07/07, Bill Hoffman <bill.hoffman at kitware.com> wrote:
> Paul Richards wrote:
> > Hi,
> > I'd like to draw your attention to this problem.
> >
> > I have local changes to remove this option and am happy to send a
> > patch to the CMake mailing list.  I'd like to understand your motives
> > for adding this option in the first place.
> >
> >
> >
> > ---------- Forwarded message ----------
> > From: Paul Richards <paul.richards at gmail.com>
> > Date: 06-Jul-2007 16:27
> > Subject: /Zm1000 option in MSVC gives problems
> > To: cmake at cmake.org
> >
> >
> > Hi,
> > An email of this subject was posted to this mailing list back in 2004:
> > http://public.kitware.com/pipermail/cmake/2004-June/005188.html
> >
> > Quote:
> > "I think it is rather strange to have a /Zm1000 option in the compiler
> > settings for MSVC by default. According to the MSVC docs this will set
> > the compilers per heap size to 1050 Mbyte. If the compiler uses two
> > heaps (like e.g. with precompiled headers) this is already more than the
> > possible virtual memory (limit is 2GB) and will always result in a C1060
> > fatal compiler error. I also have the feeling that this option has only
> > an effect if actually more then 1 GB of memory is available, because
> > otherwise the compiler seems to discard this option. I e.g. get on  a
> > machine with 1.5 GB memory + 2GB swap a C1060 fatal error and on a
> > machine with 1GB memory and 0.5 GB swap no such error for the same
> > project. Without the /Zm1000 options my project builds fine on both
> > machines.
> >
> > I think the /Zm1000 option should go away from the defaults or at least
> > be reduced to something reasonable ( e.g. /Zm200 ). Maybe the default
> > heap size (105MByte for MSVC6) did also change in the past and the
> > /Zm1000 is some historic relict, so that it might be a good idea to
> > think about it."
> >
> >
> > I notice this problem hitting me today with MSVC6.  Is there a
> > workaround?
> >
> So, the default has to do with ITK and VTK, both projects require this
> flag or
> they will not work. It is the stack size that is being specified I
> think.  However, I think
> we are sort of stuck with it as a default due to backwards compatibility
> at this point.
> I am sure it would break a bunch of code to change it.   However, it is
> a default,
> and you can change it for your project without too much trouble (three
> lines of code).
>
> -Bill
>
>


-- 
Paul Richards


More information about the CMake mailing list