@@ -260,6 +260,7 @@ For better performance configure CPPuddle with the cmake option CPPUDDLE_DEACTIV
260
260
// not enough memory left! Cleanup and attempt again:
261
261
std::cerr << " Not enough memory left. Cleaning up unused buffers now..." << std::endl;
262
262
buffer_recycler::clean_unused_buffers ();
263
+ std::cerr << " Buffers cleaned! Try allocation again..." << std::endl;
263
264
264
265
// If there still isn't enough memory left, the caller has to handle it
265
266
// We've done all we can in here
@@ -272,6 +273,7 @@ For better performance configure CPPuddle with the cmake option CPPUDDLE_DEACTIV
272
273
instance ()[location_id].number_creation ++;
273
274
instance ()[location_id].number_bad_alloc ++;
274
275
#endif
276
+ std::cerr << " Second attempt allocation successful!" << std::endl;
275
277
if (manage_content_lifetime) {
276
278
std::uninitialized_value_construct_n (buffer, number_of_elements);
277
279
}
@@ -334,8 +336,18 @@ For better performance configure CPPuddle with the cmake option CPPUDDLE_DEACTIV
334
336
}
335
337
}
336
338
337
- // Failure -- something is very wrong
338
- throw std::runtime_error (" Tried to delete non-existing buffer" );
339
+ // TODO Throw exception instead in the futures, as soon as the recycler finalize is
340
+ // in all user codes
341
+ /* throw std::runtime_error("Tried to delete non-existing buffer"); */
342
+
343
+ // This is odd: Print warning -- however, might also happen with static
344
+ // buffers using these allocators IF the new finalize was not called. For
345
+ // now, print warning until all user-code is upgraded to the finalize method.
346
+ // This allows using current versions of cppuddle with older application code
347
+ std::cerr
348
+ << " Warning! Tried to delete non-existing buffer within CPPuddle!"
349
+ << std::endl;
350
+ std::cerr << " Did you forget to call recycler::finalize?" << std::endl;
339
351
}
340
352
341
353
private:
0 commit comments