Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
JRumerman  
#1 Posted : Thursday, December 6, 2007 6:29:41 AM(UTC)
JRumerman

Rank: Member

Groups: Member
Joined: 12/6/2007(UTC)
Posts: 7

Hi everyone,

I was wondering if anybody could take a look at this error message and throw out an idea of why it's happening.

Thx, Joel

Code:

Source: 

Aurigma.GraphicsMill 

Description: Unable to write data to stream. ; 

Stack:    at Aurigma.GraphicsMill.Codecs.FormatWriter._Close()     at Aurigma.GraphicsMill.Codecs.FormatWriter.Dispose(Boolean disposing)     at Aurigma.GraphicsMill.SyncHandler.Dispose()     at Aurigma.GraphicsMill.Codecs.FormatWriter.Dispose()     at Aurigma.GraphicsMill.Bitmap.Save(Stream stream, IEncoderOptions options)  ...

Edited by user Saturday, December 15, 2007 6:16:11 AM(UTC)  | Reason: Not specified

Alex Kon  
#2 Posted : Thursday, December 6, 2007 4:11:30 PM(UTC)
Alex Kon

Rank: Advanced Member

Groups: Member
Joined: 1/31/2005(UTC)
Posts: 458

Was thanked: 5 time(s) in 5 post(s)
Hi Joel,

You are the first with such issue and I have to say that cannot even imagine what caused this error. Could you provide us with more details?

1) What output stream do you use?

2) How large the image which you are trying to save, in which file format?

3) Does the error occurs every time, or from time to time?

And it would be great to receive code sample which reproduces the problem.

JRumerman  
#3 Posted : Friday, December 7, 2007 3:24:05 AM(UTC)
JRumerman

Rank: Member

Groups: Member
Joined: 12/6/2007(UTC)
Posts: 7

Hi Alex,

We found what was causing the "unable to write data to stream" error. It was an error on our part.

However, we are seeing what we believe is a memory leak when the Save fails.

Here's our code:

Code:

for (int i = 0; i < 1000; i++)
            {
                try
                {
                    using (FileStream fs = new FileStream("C:\\06-0000313236-03-05_20070904212918847.jpg", FileMode.Open))
                    {
                        Byte[] bytes = new Byte[fs.Length];
                        fs.Read(bytes, 0, int.Parse(fs.Length.ToString()));

                        using (MemoryStream ms = new MemoryStream(bytes))
                        using (Aurigma.GraphicsMill.Bitmap bitmap = new Aurigma.GraphicsMill.Bitmap(ms))
                        {
                            int iImgHeight = bitmap.Height;
                            int iImgWidth = bitmap.Width;
                            if (bitmap.IsCmyk)
                            {
                                using (Aurigma.GraphicsMill.Transforms.PixelFormatConverter pixelConverter = new Aurigma.GraphicsMill.Transforms.PixelFormatConverter())
                                {
                                    pixelConverter.DestinationPixelFormat = Aurigma.GraphicsMill.PixelFormat.Format32bppArgb;
                                    pixelConverter.ApplyTransform(bitmap);
                                    bitmap.Save(ms, new Aurigma.GraphicsMill.Codecs.JpegEncoderOptions(100, false));
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    ex.ToString();
                }
            }

Attached is the image that we're using to test.

An exception occurs on the Save (which is ok for right now as that's what we're testing), but we're not seeing the memory released through the automatic calling of the Dispose method by the using statement. To double check we wrote the using statement as a try/catch/finally block and saw the same results.

We also tested adding a GC.Collect in the exception handler to force the GC to collect, but didn't see any improvement.

The leak isn't huge, but it's steady ~300K a call.

We think the leak is happening because Aurigma.GraphicsMill.StreamWrapper associated to the Bitmap isn't being disposed of properly. That's what our MemoryProfiling is showing us at least.

We're seeing the number of instances of System.Byte[], System.IO.MemoryStream, and Aurigma.GraphicsMill.StreamWrapper grow by the number of loop iterations.

Do you see anything that we're doing wrong and if you agree that there's a memory leak on your end, do you have a work around?

Thx, Joel

Edited by user Saturday, December 15, 2007 6:16:26 AM(UTC)  | Reason: Not specified

JRumerman attached the following image(s):
06-0000313236-03-05_20070904212918847.jpg
Alex Kon  
#4 Posted : Sunday, December 9, 2007 7:34:12 PM(UTC)
Alex Kon

Rank: Advanced Member

Groups: Member
Joined: 1/31/2005(UTC)
Posts: 458

Was thanked: 5 time(s) in 5 post(s)
Hello Joel,

Yes, we confim the issue. It will be fixed in the next release. If this problem is critical for you, please submit case and we will provide you with the update.

Edited by user Thursday, May 22, 2008 3:07:20 PM(UTC)  | Reason: Not specified

JRumerman  
#5 Posted : Monday, December 10, 2007 1:00:35 AM(UTC)
JRumerman

Rank: Member

Groups: Member
Joined: 12/6/2007(UTC)
Posts: 7

Hi Alex,

Thanks for confirming that this was a known issue and there is a patch available. I will be contacting support for the patch. This is pretty critical for us.

R, Joel

Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.