Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
C:\Documents and Settings\Sirius\My Documents\canon\imagemagick_test.vbs(7, 4)
(null): Catastrophic failure
Is there any fix or workaround to this available? This is a part of automated program that takes images every five minutes and labels them with Imagemagick. All goes well for about ten days and then the script fails with this error. In my test run I converted the same image in a loop and it fails every time around 3980 cycles. I can supply the source image and the wbscript code if someone wants to try.
I'm not familiar with using IM and VB but I'd say that the problem is that you aren't destroying the ImageObject each time around the loop. I suspect that the image object is growing larger by one image on each pass through the loop until you run out of ram.
Your loop should look something like this:
Dim img
do while true
Set img = CreateObject("ImageMagickObject.MagickImage.1")
n=n+1
jpeg="20110308-070845UTC.jpg"
timestamp="'"+cstr(n)+"'"
msgs = img.Convert(jpeg,"-font=C:\Windows\fonts\arial.ttf","-rotate=-90", "-gravity=south", "-stroke='#000C'", "-strokewidth=2", "-pointsize=20", "-draw=text 0,5 "+timestamp, "-fill=yellow", "-stroke=none", "-draw=text 0,5 "+timestamp, "imagemagick_test.jpg")
>>>Destroy the image object here - I don't know the specific syntax for it
loop
Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
el_supremo wrote:I'm not familiar with using IM and VB but I'd say that the problem is that you aren't destroying the ImageObject each time around the loop. I suspect that the image object is growing larger by one image on each pass through the loop until you run out of ram.
Pete
Thanks Pete! This is a good suggestion. But unfortunately it makes no difference. The imagemagick object breaks about the same time even if I destroy and re-create the object in the loop. It is rather strange why this happens.
There is some memory leak, but it is very small. The process takes in the beginning (after the first loop) about 10 000 Kb of memory and at the end about 12 000 kb.
I am not a VB or windows programmer, but I do have a couple of suggestions..
First IM will delay reading in some things like configuration files until it needs them.
As such teh 'type.xml' for fonts or 'colors.xml' for colornames to RGB valuse will not be read in until needed. As such teh first time though the loop may show some memory increase. However larger runs should not show any other increases if everything is removed and destroyed properly.
Of course some languages (I do not know if VB is included in this) have a very lasy garbage collection making this harder.
One suggestion however is to do a 'fake' run with less options and see if you can track down exactly what option is causing the memory leak.
anthony wrote:One suggestion however is to do a 'fake' run with less options and see if you can track down exactly what option is causing the memory leak.
Hello Anthony!
Good suggestion. I tried to remove as many options as possible and still get the error. The simplest I could get was this:
We cannot reproduce your problem. We're using ImageMagick 6.7.2-6, the current release. You VBS script has iterated over 50000 times now without complaint.
We tried your script again and this time its looped over 250,000 times and is still going. We also ran a memory checker against ImageMagick and it did not report any leaks. That leaves 3 possibilities, something about your environment, a leak in ImageMagickObject, or a flaw in your script. We did not write the ImageMagick COM object, its contributed. If the flaw is there, we must depend on a Windows developer to identify and patch. We're not sure that if you need to destroy the ImageMagick object in the your loop. It looks like we are unable to resolve this problem.
Thank you for trying! So you are not running the script under Windows? I have Win XP sp3 on the both computers. Because of camera hardware etc. I cannot choose any other operating system.
I have tried both re-using and deleting the object in the loop, neither works.
Is there any way to talk with the windows developer(s)? For me it would be not too difficult to run the script with a debugger and see what is wrong when the error happens. With the last version the error happens every time at the same moment, it is very repeatable.
And you have ImageMagick-6.7.2-6-Q16-windows-dll.exe ? This is strange. I just ran thge script again and it failed after 21429 cycles.
Is there anything I can do to help locating the problem?