Permalink
Browse files

Add a heuristic to detect a node-killing memory alloc

  • Loading branch information...
1 parent 944a57d commit c7efe6ebe32767f8d29c2a14463b2c4505034ff0 @novas0x2a novas0x2a committed May 18, 2010
Showing with 5 additions and 1 deletion.
  1. +5 −1 src/vw/Plate/hirise2tif.cc
@@ -605,7 +605,11 @@ int main( int argc, char *argv[] ) {
// Prepare the composite
composite.set_draft_mode( true );
composite.prepare();
-
+
+ // Heuristic: If the image area is bigger than 100K by 100K, die before we trigger an OOM.
+ VW_ASSERT(uint64(composite.cols()) * uint64(composite.rows()) < 10000000000ULL,
+ LogicErr() << "Composite is WAY too big (" << composite.cols() << " x " << composite.rows() << "). Something's wrong!");
+
std::cout << "\t--> Generating output GeoTIFF. Size = " << composite.cols() << " x " << composite.rows() << "\n";
DiskImageResourceGDAL::Options gdal_options;
gdal_options["COMPRESS"] = "LZW";

0 comments on commit c7efe6e

Please sign in to comment.