I am using ImageMagick on Mac OS X Lion (10.7.4) with MacPorts release ImageMagick-6.7.7-2_0+q16.darwin_11.x86_64. The relevant code snippet (C++) is:
Image newImage(sourceImage);
cout << progName << ": image opened" << endl;
if (!nothingToDo) {
cout << progName << ": 'conv.str()' is " << conv.str() << endl;
newImage.zoom(conv.str());
cout << progName << ": image zoomed by " << conv << endl;
}
The compile/link command is:
g++ -std=c++98 -W -Wall -O2 -DHOME="\"/Users/loreti\"" \
`Magick++-config --cppflags --cxxflags` -c -o prs.o prs.cxx
gcc -std=c99 -pedantic -W -Wall -O2 -DHOME="\"/Users/loreti\"" -c -o cutils.o cutils.c
g++ \
`Magick++-config --ldflags --libs` -o prs prs.o cutils.o
The program output is:
MLO@bigmac 26 $ ./prs -f ~/work -l mprs: end of command line processing.
From: "/Users/loreti/work"
To: "/Users/loreti/tmp"
Length: 768 pixels
Size: 500 kBytes
prs: skipped "."
prs: skipped ".."
prs: skipped ".DS_Store"
prs: inserted "IMG_3992.JPG"
prs: source "/Users/loreti/work", destination "/Users/loreti/tmp".
prs: image opened
prs: 'conv.str()' is 768x
prs(57402) malloc: *** error for object 0x8000000000000000: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6
Obviously there is an internal error in your library triggered by the statement newImage.zoom("768x").
The original image, copied to newImage for resining, is:
MLO@bigmac 27 $ identify ~/work/IMG_3992.JPG
/Users/loreti/work/IMG_3992.JPG JPEG 4353x3132 4353x3132+0+0 8-bit DirectClass 4.919MB 0.000u 0:00.000
Please, help....
Error: pointer being freed was not allocated
Re: Error: pointer being freed was not allocated
As a side note, all was OK with ImageMagick 6.6.5.10: on Linux (fedora 15):
MLO@mlap 6 $ ./prs -f ~/work -l m
prs: source "/home/loreti/work", destination "/home/loreti/tmp".
prs: image opened
prs: 'conv.str()' is 768x
prs: image zoomed by 0x7fff70c4d758
prs: image quality changed to 97
prs: image written
IMG_3992.JPG: 4803.37 kB, 4353x3132 -> 768x553 (q=97), 179.023 kB
prs: 1 file processed
MLO@mlap 7 $ rpm -q ImageMagick
ImageMagick-6.6.5.10-20.fc15.x86_64
And the program ran OK under Mac OS X with thw same old 6.6.5.10 ImageMagick release.
Please...
MLO@mlap 6 $ ./prs -f ~/work -l m
prs: source "/home/loreti/work", destination "/home/loreti/tmp".
prs: image opened
prs: 'conv.str()' is 768x
prs: image zoomed by 0x7fff70c4d758
prs: image quality changed to 97
prs: image written
IMG_3992.JPG: 4803.37 kB, 4353x3132 -> 768x553 (q=97), 179.023 kB
prs: 1 file processed
MLO@mlap 7 $ rpm -q ImageMagick
ImageMagick-6.6.5.10-20.fc15.x86_64
And the program ran OK under Mac OS X with thw same old 6.6.5.10 ImageMagick release.
Please...
Re: Error: pointer being freed was not allocated
We can reproduce the problem you reported and have a patch. Look for it in the ImageMagck-6.7.7-3 release by sometime tomorrow. Thanks.
Re: Error: pointer being freed was not allocated
Thank YOU for the quick fix and the reply.
-
- Posts: 6
- Joined: 2012-07-09T05:02:07-07:00
- Authentication code: 13
Re: Error: pointer being freed was not allocated
Sorry about posting to this already resolved ticket, but I have found another place where is fails with the same error..
It was hapenning to 6.7.7-2+q16.darwin_11.x86_64 (Macports) and I have waited until new macport release (6.8.0) to check if it was also resolved but its not.
It occurs when I try to resize the readed image using Image.Transform() method.
Image img("/render/test.png");
img.transform("100x100");
This is the returned error:
node(58428) malloc: *** error for object 0x5: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Im calling ImageMagick (Magick++) methods from a dylib loaded into a custom app.
Thanks in advance
L
It was hapenning to 6.7.7-2+q16.darwin_11.x86_64 (Macports) and I have waited until new macport release (6.8.0) to check if it was also resolved but its not.
It occurs when I try to resize the readed image using Image.Transform() method.
Image img("/render/test.png");
img.transform("100x100");
This is the returned error:
node(58428) malloc: *** error for object 0x5: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Im calling ImageMagick (Magick++) methods from a dylib loaded into a custom app.
Thanks in advance
L
Re: Error: pointer being freed was not allocated
We could not reproduce the fault. Perhaps its image specific. Can you post a URL to your image. We'll download it and try again.
-
- Posts: 6
- Joined: 2012-07-09T05:02:07-07:00
- Authentication code: 13
Re: Error: pointer being freed was not allocated
Thanks for your quickly answer and the confirmation that its not a bug but my error.
My library is also compiled as .so and .dll without any issue with Image.Transform(). I only have added InitializeMagick(NULL); call and it has begun to work in Mac without any issues. (I hadnt got that call previously but it was working perfectly in win and linux, with an older version so I didnt realize it could be the problem)
Thank you again and sorry for the noise.
L
My library is also compiled as .so and .dll without any issue with Image.Transform(). I only have added InitializeMagick(NULL); call and it has begun to work in Mac without any issues. (I hadnt got that call previously but it was working perfectly in win and linux, with an older version so I didnt realize it could be the problem)
Thank you again and sorry for the noise.
L
Re: Error: pointer being freed was not allocated
InitializeMagick() is recommended but should not be necessary. Our tests were without calling InitializeMagick(). We'll keep investigating and see if we can reproduce the bug.
Re: Error: pointer being freed was not allocated
Hi there - I have waited for a new macports release of ImageMagick, and I have now on my iMac release 6.7.8-0 . I have linked against its library, but the error persists. The same error. You said that in 6.7.7-3 the error was corrected but... please...
Re: Error: pointer being freed was not allocated
Here is a minimal example:
$ wget http://www.imagemagick.org/image/logo.jpg
...
$ identify logo.jpg
$ logo.jpg JPEG 123x118 123x118+0+0 8-bit DirectClass 16.2KB 0.000u 0:00.000
$ cat minimal.cxx
#include <iostream>
#include <Magick++.h>
using namespace std;
using namespace Magick;
int main() {
try {
Image sourceImage("logo.jpg");
Image newImage(sourceImage);
newImage.zoom("50x");
newImage.write("newlogo.jpg");
} catch (Error &e) {
cerr << e.what() << '\n';
} catch (...) {
cerr << "Unknown exception catched\n";
}
}
$ g++ `Magick++-config --cppflags --cxxflags --ldflags --libs` -o minimal minimal.cxx
$ ./minimal
minimal(18180) malloc: *** error for object 0xb00007fff48c14c7: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6
$
$ wget http://www.imagemagick.org/image/logo.jpg
...
$ identify logo.jpg
$ logo.jpg JPEG 123x118 123x118+0+0 8-bit DirectClass 16.2KB 0.000u 0:00.000
$ cat minimal.cxx
#include <iostream>
#include <Magick++.h>
using namespace std;
using namespace Magick;
int main() {
try {
Image sourceImage("logo.jpg");
Image newImage(sourceImage);
newImage.zoom("50x");
newImage.write("newlogo.jpg");
} catch (Error &e) {
cerr << e.what() << '\n';
} catch (...) {
cerr << "Unknown exception catched\n";
}
}
$ g++ `Magick++-config --cppflags --cxxflags --ldflags --libs` -o minimal minimal.cxx
$ ./minimal
minimal(18180) malloc: *** error for object 0xb00007fff48c14c7: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6
$