This forum contains outdated content and is available for reading only. Please contact technical support if you have any questions.

Notification

Icon
Error

2 Pages12>
Options
Go to last post Go to first unread
amf  
#1 Posted : Sunday, January 13, 2008 12:36:53 AM(UTC)
amf

Rank: Member

Groups: Guest
Joined: 10/1/2006(UTC)
Posts: 10

I'm seeing a major memory issue with GM (both 3.5 and 4.5).

Here's some sample code to show the problem:

Code:

    Public Function ScalePictureToMemory(ByVal img() As Byte, ByVal ext As String) As Byte()

        ' since it's going into a word doc, make it max resolution of 150 dpi in both directions
        ' and a max width of 7.5 inches and a max height of 10 inches.
        Dim strm As New System.IO.MemoryStream(img)
        Dim bitmap As New Aurigma.GraphicsMill.Bitmap(strm)

        Dim height As Integer = bitmap.Height
        Dim width As Integer = bitmap.Width
        Dim sizeX As Single = (width / bitmap.HorizontalResolution)
        Dim sizeY As Single = (height / bitmap.VerticalResolution)
        Dim maxReduction As Single = 1
        If sizeX > 7.5 Then maxReduction = Math.Min(maxReduction, 7.5 / sizeX)
        If sizeY > 10 Then maxReduction = Math.Min(maxReduction, 10 / sizeY)

        Dim outStrm As New MemoryStream
        Dim results() As Byte
        Try
            Dim maxXResolution = Math.Min(bitmap.HorizontalResolution, 150)
            Dim maxYResolution = Math.Min(bitmap.VerticalResolution, 150)
            If maxReduction < 1 Or bitmap.HorizontalResolution > 150 Or bitmap.VerticalResolution > 150 Then
                ' needs reduction and/or lossy compression
                bitmap.HorizontalResolution = maxXResolution
                bitmap.VerticalResolution = maxYResolution
                bitmap.Transforms.Resize(sizeX * maxReduction * maxXResolution, sizeY * maxReduction * maxYResolution, Aurigma.GraphicsMill.Transforms.ResizeMode.Resize, InterpolationMode.HighQuality)

                bitmap.Save(outStrm, New JpegEncoderOptions)
                Return outStrm.ToArray()
            ElseIf ext.ToLower.EndsWith("jpg") Or ext.ToLower.EndsWith("jpeg") Then
                ' small enough AND jpeg already
                Return img
            Else
                ' small enough, but let's try to make it smaller by making it lossy
                bitmap.Save(outStrm, New JpegEncoderOptions)
                Return outStrm.ToArray()
            End If
        Finally
            'bitmap.Dispose()
            strm.Close()
            outStrm.Close()
            bitmap.Dispose()
        End Try
    End Function

The loop to run the code is this:

Code:

        Dim imageData() As Byte = <the contents from a jpg file>
        For i As Integer = 0 To 200000
            If i Mod 100 = 0 Then
                Console.WriteLine(i)
            End If
            Dim newImage(imageData.Length - 1) As Byte
            imageData.CopyTo(newImage, 0)
            Dim img() As Byte = ScalePictureToMemory(newImage, ".jpg")
        Next

I can run the program with a 170K jpg file and the loop gets to around 7000 before my system runs out of memory. What appears to be happening is that something in GM is holding onto the memorystream, which in turn is holding onto the bytes in the variable newImage (170K of them). I have GM 3.5 and it's in there as well as the 4.5 eval I downloaded. Help?

Edited by user Wednesday, January 16, 2008 7:59:18 PM(UTC)  | Reason: Not specified

Alex Kon  
#2 Posted : Wednesday, January 16, 2008 7:56:38 PM(UTC)
Alex Kon

Rank: Advanced Member

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

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

Sorry for delay, but I just wanted to be sure in our results. It is very strange, but we cannot reproduce this issue in our tests. However this is very important message for us and we will continue testing.

Please submit case with complete test application which reproduces the issue with the sample image ?

Edited by user Thursday, May 22, 2008 2:26:18 PM(UTC)  | Reason: Not specified

amf  
#3 Posted : Wednesday, January 16, 2008 8:05:35 PM(UTC)
amf

Rank: Member

Groups: Guest
Joined: 10/1/2006(UTC)
Posts: 10

I forgot to mention, this is using .NET 1.1. Does that change your testing?
Alex Kon  
#4 Posted : Wednesday, January 16, 2008 8:46:42 PM(UTC)
Alex Kon

Rank: Advanced Member

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

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

No, it seems that NET 1.1 version also works correctly.

Do you have any differences between NET 2.0 and NET 1.1 behaviour in your tests? Could you send us sample file & project? Maybe I just missed something...

sviluppophotosi  
#5 Posted : Tuesday, February 5, 2008 4:55:10 PM(UTC)
sviluppophotosi

Rank: Advanced Member

Groups: Guest
Joined: 2/5/2008(UTC)
Posts: 30

We have the same problem here, we load a lot of bitmaps and every time we dispose all the bitmap after we use it. But some times we get "unable to commit memory" without any reason.

Any news about this issue?

Alex Kon  
#6 Posted : Tuesday, February 5, 2008 10:16:18 PM(UTC)
Alex Kon

Rank: Advanced Member

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

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

Which version of the Graphics Mill for .NET do you use? Please, try to install the latest version 4.5.17 and let me know whether the problem can be reproduced with it.

meriturva  
#7 Posted : Wednesday, February 6, 2008 4:40:19 AM(UTC)
meriturva

Rank: Newbie

Groups: Guest
Joined: 2/4/2008(UTC)
Posts: 6

we are going to test the new version....i will inform you if it will appens again.

Thanks!

Meriturva

Alex Kon  
#8 Posted : Wednesday, February 6, 2008 5:52:36 PM(UTC)
Alex Kon

Rank: Advanced Member

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

Was thanked: 5 time(s) in 5 post(s)
OK, I will be looking forward for your answer.
sviluppophotosi  
#9 Posted : Thursday, February 14, 2008 8:58:49 PM(UTC)
sviluppophotosi

Rank: Advanced Member

Groups: Guest
Joined: 2/5/2008(UTC)
Posts: 30

We had this issue again.

We have checked and we dispose every objects. We actually use bitmaps, pdfframes and pdfwriters.

How to give you more information about it?

we just have so many memory used by the application and if we use a memory profiler utility and we didn't see any strange memory consuption.

We use the last version (4.5.17) of graphmill.net framework 2

Meriturva

Edited by user Thursday, February 14, 2008 9:06:01 PM(UTC)  | Reason: Not specified

Alex Kon  
#10 Posted : Thursday, February 14, 2008 9:54:26 PM(UTC)
Alex Kon

Rank: Advanced Member

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

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

Could you provide us with more information about usual memory consumption of your application, how many files do you process, which objects and classes do you use when the issue appears?

And sample project which illustrates the issue - that would be really great!

If it is not acceptable for you to publish this information here, feel free to submit case.

Edited by user Thursday, May 22, 2008 2:42:08 PM(UTC)  | Reason: Not specified

meriturva  
#11 Posted : Friday, February 15, 2008 7:58:36 AM(UTC)
meriturva

Rank: Newbie

Groups: Guest
Joined: 2/4/2008(UTC)
Posts: 6

we had a long session here with so many tests and different approach to take more information about the libraries we use.

Seems that now we have found the issue.

it was related no to your great library but with the itextshart library and one specific approach to merge different pdf. now we use a more simple approach with the class PdfCopy and the method freeReader.

We use iThetSharp because we didn't find a way to do it with your library. we need just to merge different pdfs. are you planing to push up the pdf functionality (read and write) on the future of the graphMill? i mean, will be great to have an add-on just to handle pdf files...even if we have to pay for the add.on!

Any way thanks so much for the product and the support....it is money well spent!

thanks.

Meriturva

Edited by user Friday, February 15, 2008 7:59:29 AM(UTC)  | Reason: Not specified

Dmitry  
#12 Posted : Monday, February 18, 2008 3:54:49 PM(UTC)
Dmitry

Rank: Advanced Member

Groups: Guest
Joined: 8/3/2003(UTC)
Posts: 1,070

Thanks: 1 times
Was thanked: 12 time(s) in 12 post(s)
Thanks for getting us to know about real reason of the problem.

Graphics Mill for .NET has the ability to construct PDF from images. Unfortunately read capability is not supported. We have plans to add this functionality in the future but now I cannot tell you what version of Graphics Mill will have this functionality.

Sincerely yours,

Dmitry Sevostyanov

UserPostedImage Follow Aurigma on Twitter!

meriturva  
#13 Posted : Wednesday, February 20, 2008 5:36:12 PM(UTC)
meriturva

Rank: Newbie

Groups: Guest
Joined: 2/4/2008(UTC)
Posts: 6

i'm really sorry but now we have more information about this issue, and it is related to your library or a bad use by us.

The memory is not released after we use the pdf functionality from your graphmill.net, we use to save pdf to share network directory.

Here a sample code we use:

Code:
_pdfWriter = new PdfWriter(page.FileName);
PdfFrame pdfFrame = new PdfFrame(pageBitmap, p.Quality);
_pdfWriter.AddFrame(pdfFrame);
pdfFrame.Dispose();

if (pageBitmap != null)
         pageBitmap.Dispose();
         pageBitmap = null;
}

After we append some pages we close the pdfwriter:

Code:
if (_pdfWriter != null)
            {
                _pdfWriter.Close();
                _pdfWriter.Dispose();
                _pdfWriter = null;
            }

after that we have a memory amount consumed from the application near the size of the finale pdf, so i think that the stream or the byte[] of the pdfWriter file is not relased.

So do you have an idea about it?

Thanks

Meriturva

Edited by user Thursday, May 22, 2008 2:42:31 PM(UTC)  | Reason: Not specified

meriturva  
#14 Posted : Thursday, February 21, 2008 3:57:18 PM(UTC)
meriturva

Rank: Newbie

Groups: Guest
Joined: 2/4/2008(UTC)
Posts: 6

no news about this issue?

please we just would like to have a confirmation or an help to use in the right way the pdf feature from your library.

Thanks

Meriturva

Alex Kon  
#15 Posted : Thursday, February 21, 2008 4:42:51 PM(UTC)
Alex Kon

Rank: Advanced Member

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

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

You code is correct - it is our issue for sure. Our team is already working on it and this fix will be included in the next release of Graphics Mill for .NET.

Please, could you submit case so we can notify you when the issue will be fixed?

Edited by user Thursday, May 22, 2008 2:51:00 PM(UTC)  | Reason: Not specified

meriturva  
#16 Posted : Sunday, February 24, 2008 4:28:50 PM(UTC)
meriturva

Rank: Newbie

Groups: Guest
Joined: 2/4/2008(UTC)
Posts: 6

any news about that issue?

thanks

Meriturva

Andrew  
#17 Posted : Wednesday, February 27, 2008 8:45:39 PM(UTC)
Andrew

Rank: Advanced Member

Groups: Guest
Joined: 8/2/2003(UTC)
Posts: 876

Thanks: 2 times
Was thanked: 27 time(s) in 27 post(s)
Guys have fixed it yesterday. Here is a link for updated DLLs:

http://www.aurigma.com/D...phicsMill45_20080227.zip

Also we will include this fix into the nearest update.

Luis Delgado  
#18 Posted : Thursday, February 28, 2008 1:37:26 AM(UTC)
Luis Delgado

Rank: Member

Groups: Guest
Joined: 12/5/2007(UTC)
Posts: 5

Hi,

I replaced the existing DLLs from the installation directory with the ones above. Then I removed the existing references in my project and added them again. When I tried to recompile the project it fails. It says it cannot find the Aurigma namespace. When I replaced the libraries I did notice a version change in VS2005. Aurigma.GraphicMill.dll was displayed as version 4.5.23 (previous was 4.5.17).

Am I doing something wrong?

Thanks Luis

Luis Delgado  
#19 Posted : Thursday, February 28, 2008 2:15:50 AM(UTC)
Luis Delgado

Rank: Member

Groups: Guest
Joined: 12/5/2007(UTC)
Posts: 5

Never mind. I forgot to replace the reference in another project within the solution so it created a conflict. I replaced the libraries in all the necessary projects and everything worked fine.

Luis

Dmitry  
#20 Posted : Thursday, February 28, 2008 2:21:46 AM(UTC)
Dmitry

Rank: Advanced Member

Groups: Guest
Joined: 8/3/2003(UTC)
Posts: 1,070

Thanks: 1 times
Was thanked: 12 time(s) in 12 post(s)
Thank you, Luis.

Do not hesitate to contact our team in case of any problems or difficulties. We will be happy to assist you.

Sincerely yours,

Dmitry Sevostyanov

UserPostedImage Follow Aurigma on Twitter!

Users browsing this topic
Guest (8)
Similar Topics
Iterating over a large list & memory leak (Discussions – Graphics Mill)
by nokturnal 8/2/2017 5:43:53 AM(UTC)
Memory Leak in 4.5.23 (Discussions – Graphics Mill)
by JRumerman 4/11/2008 1:43:07 AM(UTC)
memory leaks when threading (Discussions – Graphics Mill)
by BillPlunkett 4/19/2005 12:26:00 AM(UTC)
2 Pages12>
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.