RMagick: UnableToConcatenateString `

J

Jonathan Denni

I have a program to generate my website <a
href='bluebottleimages.org'>bluebottleimages.org</a>

It creates thumbnails using Rmagick. I run the program (on the server),
and it goes for a while, but then I get

RMagick: UnableToConcatenateString `
'.
Warning: recursive semaphore lock detected!

and it's stopped there.

It has come up invariably at the same spot, so I thought it was
corrupted image files, but even after replacing them I get the error
message. Now I'm thinking that it's probably just that I'm over-using
server resources making all those thumbnails... Do you think that's
the case, or is it more likely that there's a problem with my program?

If you like I can post my code.
 
T

Tim Hunter

Jonathan said:
I have a program to generate my website <a
href='bluebottleimages.org'>bluebottleimages.org</a>

It creates thumbnails using Rmagick. I run the program (on the server),
and it goes for a while, but then I get

RMagick: UnableToConcatenateString `
'.
Warning: recursive semaphore lock detected!

and it's stopped there.

It has come up invariably at the same spot, so I thought it was
corrupted image files, but even after replacing them I get the error
message. Now I'm thinking that it's probably just that I'm over-using
server resources making all those thumbnails... Do you think that's
the case, or is it more likely that there's a problem with my program?

If you like I can post my code.

Try adding a periodic call to GC.start to your program. See this note:
http://rubyforge.org/forum/forum.php?thread_id=1374&forum_id=1618
 
T

Tim Hunter

Jonathan said:
Thanks! It works perfectly now

Good news!

Looking forward, starting with RMagick 2.0.0 you can free the memory
used by individual image objects with the Magick::Image#destroy! method,
thus eliminating the need to call GC.start from time to time.
 
J

Joel VanderWerf

Tim said:
Good news!

Looking forward, starting with RMagick 2.0.0 you can free the memory
used by individual image objects with the Magick::Image#destroy! method,
thus eliminating the need to call GC.start from time to time.

Seems like ruby could help out libraries like RMagick by exposing an API
to tell GC that memory has been allocated by something other than ruby's
malloc. Did anyone ever pursue that?
 
T

Tim Hunter

Joel said:
Seems like ruby could help out libraries like RMagick by exposing an API
to tell GC that memory has been allocated by something other than ruby's
malloc. Did anyone ever pursue that?

This may help in the general case but for RMagick not so much. RMagick
doesn't know how much memory ImageMagick is allocating for an image.
Even if it knew or could compute the amount of the initial allocation
the amount of memory used for an image can vary over the lifetime of the
image. I suppose RMagick could give Ruby an estimate, which might help
some.

I gave some thought to trying to get ImageMagick to use Ruby's memory
management API. It seems like it might solve the problem, but I'm not
sure that the IM developers would want to devote that much effort to
Ruby users.

Adding #destroy! is something I could do on my own. It more-or-less
parallels the way you can close files and sockets and otherwise free up
resources that Ruby either doesn't know about or might let hang around
longer than necessary.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,264
Messages
2,571,323
Members
48,005
Latest member
ChasityFan

Latest Threads

Top