[gdal-dev] exception, while creating large image

mail2vajram mail2vajram at gmail.com
Mon Jul 26 06:10:34 EDT 2010


in my application i need to create multiple images with large size using C#.
while creating multiple files first three images created successfully after
that i got the following exception.

ContextSwitchDeadLock was detecteed



The CLR has been unable to transition from COM context 0x204d28 to COM
context 0x204e98 for 60 seconds. The thread that owns the destination
context/apartment is most likely either doing a non pumping wait or
processing a very long running operation without pumping Windows messages.
This situation generally has a negative performance impact and may even lead
to the application becoming non responsive or memory usage accumulating
continually over time. To avoid this problem, all single threaded apartment
(STA) threads should use pumping wait primitives (such as
CoWaitForMultipleHandles) and routinely pump messages during long running
operations.


my code is.....


for (i = 1; i < vallist; i++)
            {

                // create new trans images....
                Driver createtransdriver = Gdal.GetDriverByName("HFA");
                Dataset createtransdataset =
createtransdriver.Create(startuppath + "\\Transimages\\Calss_" +
i.ToString() + ".IMG", band.XSize, band.YSize, 1, DataType.GDT_Float32,
null);
                Band createtransband = createtransdataset.GetRasterBand(1);


                for (j = 0; j < band.YSize; j++)
                {

                    for (k = 0; k < band.XSize; k++)
                    {
                        band.ReadRaster(k, j, 1, 1, value, 1, 1, 1, 1);
                        if (value[0] == 0)
                        {

                            createtransband.WriteRaster(k, j, 1, 1, value,
1, 1, 1, 1);
                        }
                        else
                        {
                            imgval = arrayprobs[value[0] - 1, i - 1];
                            value[0] = Convert.ToInt32(imgval);
                            createtransband.WriteRaster(k, j, 1, 1, value,
1, 1, 1, 1);

                        }
                    }

                }
                createtransband = null;
                createtransdataset = null;
                createtransdriver = null;


            }



how to overcome this..............


help me please
-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/exception-while-creating-large-image-tp5337330p5337330.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list