[Insight-users] puzzle about the compiler heap limit of msvc

Ron Inbar ron@mediguide.co.il
Wed, 2 Apr 2003 17:53:15 +0200


Hi,

I also ran into these problems when compiling VTK.
If you try to compile it several times in a row, the compiler succeeds in=

compiling more files each time.  So maybe you should try this easy soluti=
on
before anything else, even though it is a bit annoying and time-consuming=
.

Ron


> -----Original Message-----
> From: Luis Ibanez [mailto:luis.ibanez@kitware.com]
> Sent: Wednesday, April 02, 2003 4:42 PM
> To: Chen Fu
> Cc: Insight-users@public.kitware.com
> Subject: Re: [Insight-users] puzzle about the compiler heap limit of ms=
vc
>=20
>=20
> Hi Chen,
>=20
> Most Insight applications are happy with
> a heap size =3D /Zm1000 in VisualStudio 7.0
>=20
> The problem in your code looks more like
> some recursive inclusion of files.
>=20
> Your wrapping looks nice though...
>=20
> Possible suspects are the global typedefs,
> and a misspelling of the #ifdef guards in
> some class.
>=20
>=20
> For example:
>=20
>    In flowBlock.h  you are doing "typedef"s
>    outside the class FlowBlock.
>=20
>    When you include this files in others,
>    this typedefs will be global, which
>    may be undesirable.
>=20
>    We use to put the typedefs inside the
>    classes and then access them using the
>    scope resolution, like
>=20
>=20
>    class FlowBlock {
>    {
>     public:
>       typedef  unsigned char  PixelType;
>       typedef  itk::Image< PixelType,  2 >   ImageType;
>     public:
>       void SetInput(ImageType* input);
>       ImageType* GetOutput();
>    };
>=20
>=20
>    Then in the derived class
>=20
>=20
>    class Source: public FlowBlock
>    {
>    public:
>         typedef FlowBlock::ImageType  ImageType;
>  	typedef itk::ImageFileReader< ImageType  >
>                                         ReaderType;
>=20
>  	ReaderType::Pointer reader;
>=20
>       //...etc
>    };
>=20
>=20
> ---
>=20
> This encapsulates the types and facilitates
> to use wrapping classes with different ImageTypes
>=20
>=20
> Hope that helps,
>=20
>=20
>    Luis
>=20
>=20
>=20
> ----------------
> Chen Fu wrote:
> > Hi!
> > I use msvc7 to compile my little application of itk.
> > I package itk class into a flowblock.
> >
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> > #ifndef FLOWBLOCK_H
> > #define FLOWBLOCK_H
> >
> > #include "itkImage.h"
> >
> > typedef   unsigned char  PixelType;
> > typedef itk::Image< PixelType,  2 >   ImageType;
> >
> > class FlowBlock
> > {
> > public:
> > 	void SetInput(ImageType* input);
> > 	ImageType* GetOutput();
> > };
> >
> > #endif
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> >
> > and wrap some itk class in this block, for example
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> > #ifndef SOURCE_H
> > #define SOURCE_H
> >
> > #include "itkImageFileReader.h"
> >
> > class Source: public FlowBlock
> > {
> > public:
> > 	typedef itk::ImageFileReader< ImageType  >
> > ReaderType;
> >
> > 	ReaderType::Pointer reader;
> >
> > 	Source()
> > 	{
> > 		reader =3D ReaderType::New();
> > 	}
> >
> > 	void SetInput(ImageType* input)
> > 	{
> > 	}
> >
> > 	ImageType * GetOutput()
> > 	{
> > 		return reader->GetOutput();
> > 	}
> > };
> >
> > #endif
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
> >
> > besides the source, there are also sink(writer) and
> > various filter.
> >
> > But if i include several such header file(.h), the
> > msvc7 report c1076 error:
> > compiler limit : internal heap limit reached (msvc)
> >
> > I turn the /zm to 1000 or 2000, but still has this
> > error.
> > I don't know what to do now. Any one can lend me a hand?
> >
> > =3D=3D=3D=3D=3D
> > Remote Scensing Satellite Ground Station
> > Chinese Academy of Science
> >
> > _________________________________________________________
> > Do You Yahoo!?
> > =D1=C5=BB=A2=CD=A8=CD=F8=C2=E7KTV, =CB=E6=CA=B1=CB=E6=B5=D8=C3=E2=B7=D1=
=BF=A8=C0=ADOK~~
> >
> http://rd.yahoo.com/mail_cn/tag/?http://cn.messenger.yahoo.com//chat/in=
dex
> .html
> > _______________________________________________
> > Insight-users mailing list
> > Insight-users@public.kitware.com
> > http://public.kitware.com/mailman/listinfo/insight-users
> >
>=20
>=20
>=20
> _______________________________________________
> Insight-users mailing list
> Insight-users@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-users
This e-mail message has been sent by MediGuide
and is for the use of the intended recipients only.
The message may contain privileged or confidential information .
If you are not the intended recipient you are hereby notified that any us=
e,
distribution or copying of this communication is strictly prohibited,
and you are requested to delete the e-mail and any attachments
and notify the sender immediately.