Menu

#24 Mem leak in ImageToBlob in GrahicsMagick

v1.0_(example)
closed
None
1
2015-11-13
2015-11-12
nikhil
No

I am using graphicsmagick-1.3.22, and I am making use of imagetoblob api, I found that there is a huge chunk of memory which is not freed up in my code.
I am calling DestroyImageList, DestroyExceptionInfo and DestroyImageInfo at the end.
I also tried calling destroyblob, I am making use of valgrind to find the leak. could you please let me know what could be the possible solution for this issue

Discussion

  • Bob Friesenhahn

    Bob Friesenhahn - 2015-11-12

    Please take a look at tests/rwblob.c in the GraphicsMagick source code as a working example. This is a test program which uses ImageToBlob(), and does not seem to have any leaks since it is part of the test suite. You should not be using DestroyBlob() since that has a completely different purpose.

    Assuming that you have debug symbols enabled in the GraphicsMagick build and your application's own build, valgrind should indicate which function and line of code created the huge allocation.

     
  • nikhil

    nikhil - 2015-11-13

    Thanks for your input Bob, I was able to figure out the issue. the imageToBlob returns a memory buffer and I assigned its address to a pointer. After all the operation I free up the pointer using free(). Now I dont see any memory leaks in my code. You can close this ticket now.

     
  • Bob Friesenhahn

    Bob Friesenhahn - 2015-11-13
    • status: open --> closed
     
  • Bob Friesenhahn

    Bob Friesenhahn - 2015-11-13

    It is good that you found the cause of the leak. The returned memory buffer is not owned by GraphicsMagick.

     

Log in to post a comment.

MongoDB Logo MongoDB