caught exception: std::bad_alloc

Bug #679309 reported by Andreas Metzler
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Hugin
Won't Fix
Low
Unassigned

Bug Description

Hello,

this is https://bugs.launchpad.net/ubuntu/+source/hugin/+bug/363903 from Ubuntu.

Loading the testase quoted in bugreport http://dl.getdropbox.com/u/921561/project.tar.gz into hugin and using the Stitch now button still yields this error with 2009.2.0rc1:
Checking nona...[OK]
Checking enblend...[OK]
Checking enfuse...[OK]
Checking hugin_hdrmerge...[OK]
Checking exiftool...[OK]
nona -z PACKBITS -r ldr -m TIFF_m -o jjljljljljjljl -i 0 /tmp/huginpto_OBVtyS
caught exception: std::bad_alloc
make: *** [jjljljljljjljl0000.tif] Error 1

Actually it is not even neccessary to go through the GUI, this command

nona -z PACKBITS -r ldr -m TIFF_m -o dsc_6798-dsc_6825 -i 0 dsc_6798-dsc_6825.pto

triggers the error.

Revision history for this message
Yuv (yuv) wrote :

thanks for the complete bug report

Revision history for this message
nicolas-laurent (nicolas-laurent) wrote :

I encountered this error too (ubuntu version 2009.2.0.4461, I don't know if it's better in version 2010*) with just 2 images, I don't know if it's applicable to the originally reported bug, but the symptoms are the same (std::bad_alloc after invocation of nona).

It seems that after some visual dragging, cropping and projection tweak in the "Fast panorama preview" it ended up with unrealistically high values in the "Panorama Canva Size" settings in the "Stitcher" tab. As I'm a casual user, it didn't shock me first, but the 2 dimensions was a tenfold higher than the cumulated size of the 2 input images.

Combined with the default "Image Cache Memory" of 50Mb it was probably causing std::bad_alloc every time.

After tweaking the settings (redoing the cropping, canva size divided by 10 in x and y, increase of image cache memory) it worked fine.

I'm just supposing here, but maybe it could be possible to detect beforehand that the projected Canva size will need more memory than available and then warn the user ?

Thank you for your hard and nice work :-)
Best Regards

Revision history for this message
noone (noone-users) wrote :

i can also repo this bug on Ubuntu 10.04 amd64.

Revision history for this message
James Legg (lankyleggy) wrote :

The canvas size on the linked project is so huge it would take petabytes of memory. So no wonder stitching it fails.

The image cache size should have no affect on this bug: the cache is not used to stitch.

Can anyone get a recent version of Hugin to erroneously set a galaxy sized canvas? If so, what are the steps for repeating it?

Revision history for this message
Bruno Postle (brunopostle) wrote :

You can get Hugin to set a ridiculously large canvas like so:

Start with a spherical or any > 180 degree panorama.
Switch projection to rectilinear, the field of view will be set to 179 degrees.
Click Calculate Optimal Size.
Change to a more useful projection or adjust the field of view and the canvas stays huge.

Maybe a solution would be for the Calculate Optimal Size button to be a checkbox that continously recalculates.

Revision history for this message
rew (r-e-wolff) wrote :

So?

How about: This is a wishlist item: Nona should produce a more useful error message: It should print something like: "unable to allocate memory for the canvas of XXXXXXXxYYYYYYY pixels. (hmm. It seems it is currently just an uncaught exception. You can catch exceptions, right?)

And separate bug: This is a whishlist item: Do something sensible in the sequence-of-events that Bruno posted.

Revision history for this message
Yuv (yuv) wrote :

James added an initial check against ridiculously large canvas sizes.

Changed in hugin:
importance: High → Low
status: New → Triaged
Revision history for this message
tmodes (tmodes) wrote :

Overcoming the size limitation would require to change how nona stitches images with a lib, which supports images bigger than the memory (RAM).
With James check I think this bug can be set to "Won't fix".

Revision history for this message
Yuv (yuv) wrote :

it would be nicer to catch the exception and terminate gracefully with an understandable error message, though. Is it difficult to do?

rew (r-e-wolff)
tags: added: canvas error large message nona
Changed in hugin:
status: Triaged → Confirmed
Revision history for this message
launchpadmember (lpuser1138) wrote :

I can confirm this problem in Hugin Version 2009.2.0.4461

Here is my output error:
Checking nona...[OK]
Checking enblend...[OK]
Checking enfuse...[OK]
Checking hugin_hdrmerge...[OK]
Checking exiftool...[OK]
nona -z PACKBITS -r ldr -m TIFF_m -o pano-0001 -i 0 /tmp/huginpto_7HyzUM
caught exception: std::bad_alloc
make: *** [pano-00010000.tif] Error 1

Revision history for this message
Yuv (yuv) wrote :

@launchpadmember (lpuser1138) I guess you have read the whole thread above. What size of canvas were you trying to stitch? Hugin 2009.2.0 that you mention is very old and no longer supported. If you posted because this error bugs you, upgrade to a newer Hugin version with the partial fix implemented by James. If you know a way to catch the exception and terminate gracefully, please post a patch.

Changed in hugin:
status: Confirmed → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.