title: C#, new Bitmap with IntPtr, ArgumentException
body: <p>I have a very strange issue.</p>
  
  <p>Here is a simplified code of mine to explain :</p>
  
  <pre><code>class Bitmap1
  {
      public Bitmap nImage;
      public IntPtr data;
  
  
      public Bitmap1()
      {
          int w = 2450;
          int h = 2450;
  
          this.data = Marshal.AllocHGlobal(w*h);
  
          nImage = new Bitmap(w, h, w, PixelFormat.Format8bppIndexed, data);
  
      }
  }
  </code></pre>
  
  <p>When <code>w</code> and <code>h</code> are equal to <strong>2448</strong>, everything works well if  I invocate the constructor.</p>
  
  <p>But when h and w are equal to <strong>2450</strong>, I have an <code>ArgumentException</code> which seems launch by the "new Bitmap(...);"</p>
  
  <p>I can't understand, and the documentation doesn't say there is a limited size for <code>Marshal.AllocHGlobal</code>.</p>
  
  <p>What's wrong? Are there other ways to do what I want ?</p>
  
  <p>Thank you very much.</p>