# Map.DrawStaticLayers OutOfMemoryException?

**URL:** <https://community.thinkgeo.com/t/map-drawstaticlayers-outofmemoryexception/7134>\
**Category:** Services\
**Created:** [March 24, 2010, 8:12am UTC](https://community.thinkgeo.com/t/map-drawstaticlayers-outofmemoryexception/7134 "2010-03-24T08:12:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guillaume](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/g/c67d28/32.png) [@Guillaume](https://community.thinkgeo.com/u/Guillaume)\
**Post date:** [March 24, 2010, 8:12am UTC](https://community.thinkgeo.com/t/map-drawstaticlayers-outofmemoryexception/7134/1 "2010-03-24T08:12:27Z")

</div>

Hello,

I'm&nbsp;encoutering&nbsp;a&nbsp;OutOfMemory&nbsp;exception&nbsp;when&nbsp;calling&nbsp;Map.DrawStaticLayers(bmp,&nbsp;GeographyUnit.Meter)&nbsp;for&nbsp;specifics&nbsp;areas.

Actually,&nbsp;my&nbsp;program&nbsp;generates&nbsp;pictures&nbsp;for&nbsp;the&nbsp;cache&nbsp;system,&nbsp;the&nbsp;bitmaps&nbsp;objects&nbsp;are&nbsp;correctly&nbsp;disposed,&nbsp;and&nbsp;the&nbsp;program&nbsp;never&nbsp;exceeds&nbsp;120&nbsp;Mb&nbsp;in&nbsp;Memory,&nbsp;but&nbsp;a&nbsp;OutOfMemoryException&nbsp;is&nbsp;thrown.&nbsp;The&nbsp;exception&nbsp;comes&nbsp;always&nbsp;for&nbsp;the&nbsp;same&nbsp;part&nbsp;of&nbsp;the&nbsp;map.

Here&nbsp;is&nbsp;the&nbsp;call&nbsp;stack&nbsp;:&nbsp;

&nbsp;bei&nbsp;ThinkGeo.MapSuite.Core.Layer.Draw(GeoCanvas&nbsp;canvas,&nbsp;Collection`1&nbsp;labelsInAllLayers)  
  
&nbsp;bei&nbsp;ThinkGeo.MapSuite.Core.MapEngine.x2a77eb6032362d14(Layer&nbsp;xa1d467ddfe47b178,&nbsp;Object&nbsp;x65e9a9c6c5e41d97)  
  
&nbsp;bei&nbsp;ThinkGeo.MapSuite.Core.MapEngine.x68ddaa28fe467d0a(IEnumerable`1&nbsp;xbc8a920bd17eefdf,&nbsp;Bitmap&nbsp;xe10299f210688dae,&nbsp;GeographyUnit&nbsp;x23bf990a35721448,&nbsp;Boolean&nbsp;xa872403da055b02a)  
  
&nbsp;bei&nbsp;ThinkGeo.MapSuite.Core.MapEngine.DrawStaticLayers(Bitmap&nbsp;gdiPlusBitmap,&nbsp;GeographyUnit&nbsp;mapUnit)  
  
&nbsp;bei&nbsp;GisCacheGenerationTool.Window1.GenerateTileSquare(Int32&nbsp;level,&nbsp;Int32&nbsp;number,&nbsp;Int32&nbsp;x,&nbsp;Int32&nbsp;y,&nbsp;Size&nbsp;packSquareSize,&nbsp;Size&nbsp;boundingBoxSize,&nbsp;Int32&nbsp;scaleId)&nbsp;in&nbsp;C:\projects\Kuba50\Implementation\Components\Src\GisCacheGenerationTool\GisCacheGenerationTool\Window1.xaml.cs:Zeile&nbsp;310.

&nbsp;

Here&nbsp;are&nbsp;some&nbsp;watchs&nbsp;from&nbsp;the&nbsp;used&nbsp;envronnement&nbsp;:

Map.StaticLayers&nbsp;(all&nbsp;layers&nbsp;are&nbsp;open)  
  
Count&nbsp;=&nbsp;25  
  
&nbsp;&nbsp;&nbsp;&nbsp;[0]:&nbsp;{ThinkGeo.MapSuite.Core.GeoTiffRasterLayer}  
  
&nbsp;&nbsp;&nbsp;&nbsp;[1]:&nbsp;{ThinkGeo.MapSuite.Core.GeoTiffRasterLayer}  
  
&nbsp;&nbsp;&nbsp;&nbsp;[2]:&nbsp;{ThinkGeo.MapSuite.Core.GeoTiffRasterLayer}  
  
&nbsp;&nbsp;&nbsp;&nbsp;[3]:&nbsp;{ThinkGeo.MapSuite.Core.GeoTiffRasterLayer}  
  
&nbsp;&nbsp;&nbsp;&nbsp;[4]:&nbsp;{ThinkGeo.MapSuite.Core.GeoTiffRasterLayer}  
  
&nbsp;&nbsp;&nbsp;&nbsp;[5]:&nbsp;{ThinkGeo.MapSuite.Core.GeoTiffRasterLayer}  
  
&nbsp;&nbsp;&nbsp;&nbsp;[6]:&nbsp;{ThinkGeo.MapSuite.Core.GeoTiffRasterLayer}  
  
&nbsp;&nbsp;&nbsp;&nbsp;[7]:&nbsp;{ThinkGeo.MapSuite.Core.GeoTiffRasterLayer}  
  
&nbsp;&nbsp;&nbsp;&nbsp;[8]:&nbsp;{ThinkGeo.MapSuite.Core.GeoTiffRasterLayer}  
  
&nbsp;&nbsp;&nbsp;&nbsp;[9]:&nbsp;{ThinkGeo.MapSuite.Core.GeoTiffRasterLayer}  
  
&nbsp;&nbsp;&nbsp;&nbsp;[10]:&nbsp;{ThinkGeo.MapSuite.Core.GeoTiffRasterLayer}  
  
&nbsp;&nbsp;&nbsp;&nbsp;[11]:&nbsp;{ThinkGeo.MapSuite.Core.GeoTiffRasterLayer}  
  
&nbsp;&nbsp;&nbsp;&nbsp;[12]:&nbsp;{ThinkGeo.MapSuite.Core.GeoTiffRasterLayer}  
  
&nbsp;&nbsp;&nbsp;&nbsp;[13]:&nbsp;{ThinkGeo.MapSuite.Core.GeoTiffRasterLayer}  
  
&nbsp;&nbsp;&nbsp;&nbsp;[14]:&nbsp;{ThinkGeo.MapSuite.Core.GeoTiffRasterLayer}  
  
&nbsp;&nbsp;&nbsp;&nbsp;[15]:&nbsp;{ThinkGeo.MapSuite.Core.GeoTiffRasterLayer}  
  
&nbsp;&nbsp;&nbsp;&nbsp;[16]:&nbsp;{ThinkGeo.MapSuite.Core.GeoTiffRasterLayer}  
  
&nbsp;&nbsp;&nbsp;&nbsp;[17]:&nbsp;{ThinkGeo.MapSuite.Core.GeoTiffRasterLayer}  
  
&nbsp;&nbsp;&nbsp;&nbsp;[18]:&nbsp;{ThinkGeo.MapSuite.Core.GeoTiffRasterLayer}  
  
&nbsp;&nbsp;&nbsp;&nbsp;[19]:&nbsp;{ThinkGeo.MapSuite.Core.GeoTiffRasterLayer}  
  
&nbsp;&nbsp;&nbsp;&nbsp;[20]:&nbsp;{ThinkGeo.MapSuite.Core.GeoTiffRasterLayer}  
  
&nbsp;&nbsp;&nbsp;&nbsp;[21]:&nbsp;{ThinkGeo.MapSuite.Core.GeoTiffRasterLayer}  
  
&nbsp;&nbsp;&nbsp;&nbsp;[22]:&nbsp;{ThinkGeo.MapSuite.Core.GeoTiffRasterLayer}  
  
&nbsp;&nbsp;&nbsp;&nbsp;[23]:&nbsp;{ThinkGeo.MapSuite.Core.GeoTiffRasterLayer}  
  
&nbsp;&nbsp;&nbsp;&nbsp;[24]:&nbsp;{ThinkGeo.MapSuite.Core.GeoTiffRasterLayer}

Map.CurrentExtent  
  
{829995.080935478,302615.353243947,859293.954696049,273316.479483257}  
  
&nbsp;&nbsp;&nbsp;&nbsp;base&nbsp;{ThinkGeo.MapSuite.Core.AreaBaseShape}:&nbsp;{829995.080935478,302615.353243947,859293.954696049,273316.479483257}  
  
&nbsp;&nbsp;&nbsp;&nbsp;Height:&nbsp;29298.873760690098  
  
&nbsp;&nbsp;&nbsp;&nbsp;LowerLeftPoint:&nbsp;{829995.080935478,273316.479483257,0}  
  
&nbsp;&nbsp;&nbsp;&nbsp;LowerRightPoint:&nbsp;{859293.954696049,273316.479483257,0}  
  
&nbsp;&nbsp;&nbsp;&nbsp;UpperLeftPoint:&nbsp;{829995.080935478,302615.353243947,0}  
  
&nbsp;&nbsp;&nbsp;&nbsp;UpperRightPoint:&nbsp;{859293.954696049,302615.353243947,0}  
  
&nbsp;&nbsp;&nbsp;&nbsp;Width:&nbsp;29298.873760570888

&nbsp;

Did&nbsp;I&nbsp;miss&nbsp;something&nbsp;?

Thanks,  
  
Guillaume  
  
&nbsp;

---

<div class="post-metadata">

**Author:** ![Val](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/v/e56c9b/32.png) [@Val](https://community.thinkgeo.com/u/Val)\
**Post date:** [March 24, 2010, 11:28am UTC](https://community.thinkgeo.com/t/map-drawstaticlayers-outofmemoryexception/7134/2 "2010-03-24T11:28:04Z")

</div>

First,&nbsp;the&nbsp;question&nbsp;you&nbsp;have&nbsp;is&nbsp;related&nbsp;to&nbsp;the&nbsp;Services&nbsp;edition,&nbsp;not&nbsp;the&nbsp;Desktop&nbsp;edition&nbsp;and&nbsp;this&nbsp;is&nbsp;why&nbsp;I&nbsp;moved&nbsp;your&nbsp;question&nbsp;to&nbsp;the&nbsp;adequate&nbsp;forum.&nbsp;&nbsp;  
&nbsp;&nbsp;Can&nbsp;you&nbsp;give&nbsp;us&nbsp;a&nbsp;little&nbsp;more&nbsp;detailed&nbsp;explanations&nbsp;of&nbsp;what&nbsp;you&nbsp;are&nbsp;doing&nbsp;with&nbsp;generating&nbsp;pictures&nbsp;for&nbsp;the&nbsp;cache&nbsp;system?&nbsp;Can&nbsp;you&nbsp;send&nbsp;us&nbsp;the&nbsp;code&nbsp;related&nbsp;to&nbsp;that?&nbsp;I&nbsp;think&nbsp;this&nbsp;is&nbsp;going&nbsp;to&nbsp;help&nbsp;us&nbsp;determining&nbsp;more&nbsp;precisely&nbsp;where&nbsp;the&nbsp;problem&nbsp;might&nbsp;reside.&nbsp;Thank&nbsp;you.

---

<div class="post-metadata">

**Author:** ![Guillaume](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/g/c67d28/32.png) [@Guillaume](https://community.thinkgeo.com/u/Guillaume)\
**Post date:** [March 25, 2010, 2:13am UTC](https://community.thinkgeo.com/t/map-drawstaticlayers-outofmemoryexception/7134/3 "2010-03-25T02:13:14Z")

</div>

Hello,  
  
  
  
Sorry&nbsp;for&nbsp;the&nbsp;lack&nbsp;of&nbsp;informations.  
  
I&nbsp;manage&nbsp;to&nbsp;recreate&nbsp;the&nbsp;problem&nbsp;in&nbsp;a&nbsp;very&nbsp;sample.  
  
The&nbsp;version&nbsp;of&nbsp;MapSuite&nbsp;I&nbsp;use&nbsp;is&nbsp;3.1.299  
  
  
  
The&nbsp;sample&nbsp;I&nbsp;created&nbsp;is&nbsp;about&nbsp;6.5Mb,&nbsp;with&nbsp;Maps.&nbsp;Here&nbsp;I&nbsp;can&nbsp;only&nbsp;send&nbsp;up&nbsp;to&nbsp;500&nbsp;Kb&nbsp;files.&nbsp;  
  
How&nbsp;can&nbsp;I&nbsp;send&nbsp;you&nbsp;this&nbsp;sample&nbsp;?

Thanks,  
  
Guillaume.

---

<div class="post-metadata">

**Author:** ![Val](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/v/e56c9b/32.png) [@Val](https://community.thinkgeo.com/u/Val)\
**Post date:** [March 25, 2010, 12:18pm UTC](https://community.thinkgeo.com/t/map-drawstaticlayers-outofmemoryexception/7134/4 "2010-03-25T12:18:49Z")

</div>

Please&nbsp;contact&nbsp;ThinkGeo&nbsp;Support&nbsp;at&nbsp;[support@thinkgeo.com](mailto:support@thinkgeo.com).&nbsp;For&nbsp;large&nbsp;files,&nbsp;we&nbsp;setup&nbsp;the&nbsp;users&nbsp;with&nbsp;an&nbsp;FTP&nbsp;account&nbsp;they&nbsp;can&nbsp;upload&nbsp;the&nbsp;files&nbsp;to&nbsp;but&nbsp;in&nbsp;your&nbsp;case,&nbsp;I&nbsp;think&nbsp;that&nbsp;6.5&nbsp;Mb&nbsp;is&nbsp;not&nbsp;too&nbsp;large&nbsp;to&nbsp;be&nbsp;emailed&nbsp;to&nbsp;Support.&nbsp;Thank&nbsp;you.
