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

Luis Ibanez luis.ibanez@kitware.com
Wed, 02 Apr 2003 09:43:09 -0500


Hi Chen,

Most Insight applications are happy with
a heap size = /Zm1000 in VisualStudio 7.0

The problem in your code looks more like
some recursive inclusion of files.

Your wrapping looks nice though...

Possible suspects are the global typedefs,
and a misspelling of the #ifdef guards in
some class.


For example:

   In flowBlock.h  you are doing "typedef"s
   outside the class FlowBlock.

   When you include this files in others,
   this typedefs will be global, which
   may be undesirable.

   We use to put the typedefs inside the
   classes and then access them using the
   scope resolution, like


   class FlowBlock {
   {
    public:
      typedef  unsigned char  PixelType;
      typedef  itk::Image< PixelType,  2 >   ImageType;
    public:
      void SetInput(ImageType* input);
      ImageType* GetOutput();
   };


   Then in the derived class


   class Source: public FlowBlock
   {
   public:
        typedef FlowBlock::ImageType  ImageType;
 	typedef itk::ImageFileReader< ImageType  >
                                        ReaderType;

 	ReaderType::Pointer reader;

      //...etc
   };


---

This encapsulates the types and facilitates
to use wrapping classes with different ImageTypes


Hope that helps,


   Luis



----------------
Chen Fu wrote:
> Hi!
> I use msvc7 to compile my little application of itk.
> I package itk class into a flowblock.
>
> ====================================================
> #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
> ====================================================
>
> and wrap some itk class in this block, for example
> ====================================================
> #ifndef SOURCE_H
> #define SOURCE_H
>
> #include "itkImageFileReader.h"
>
> class Source: public FlowBlock
> {
> public:
> 	typedef itk::ImageFileReader< ImageType  >
> ReaderType;
>
> 	ReaderType::Pointer reader;
>
> 	Source()
> 	{
> 		reader = ReaderType::New();
> 	}
>
> 	void SetInput(ImageType* input)
> 	{
> 	}
>
> 	ImageType * GetOutput()
> 	{
> 		return reader->GetOutput();
> 	}
> };
>
> #endif
> =====================================================
>
> 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?
>
> =====
> Remote Scensing Satellite Ground Station
> Chinese Academy of Science
>
> _________________________________________________________
> Do You Yahoo!?
> 雅虎通网络KTV, 随时随地免费卡拉OK~~
>
http://rd.yahoo.com/mail_cn/tag/?http://cn.messenger.yahoo.com//chat/index.html
> _______________________________________________
> Insight-users mailing list
> Insight-users@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-users
>