[Interest] Retrieving the object info due to exception std::bad_alloc
Konstantin Tokarev
annulen at yandex.ru
Thu Mar 1 00:23:22 CET 2018
28.02.2018, 09:51, "alexander golks" <alex at golks.de>:
> Am Tue, 27 Feb 2018 23:12:51 +0530
> schrieb Ramakanth Kesireddy <rama.kesi at gmail.com>:
>
>> Hi,
>>
>> As mentioned in http://doc.qt.io/archives/qt-4.8/exceptionsafety.html, the
>> below code is being used to catch the exceptions in application:-
>>
>> QApplication app(argc, argv);
>> ...
>> try {
>> app.exec();
>> } catch (const std::bad_alloc &) {
>> //clean up code and log the exception info
>> // retrieve class name and method name of object
>> return 0; // exit the application
>> }
>>
>> Please let me know if there any means to get the runtime object info like
>> class name, method name(if possible line number) throwing the exception
>> std::bad_alloc in catch block?
>
> beside your origin question:
> bad_alloc is mostly thrown due to too view memory for the request in question.
> so when you continue your program, chances are good to see more bad_allocs.
Or don't get any bad_alloc at all, being killed by OOM Killer promptly
>
> to your question:
> you may try stacktracers, like mentioned here: https://stackoverflow.com/a/691742
>
> alex
>
> --
> /*
> *No violence, gentlemen -- no violence, I beg of you! Consider the furniture!
> * -- Sherlock Holmes
> */
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
--
Regards,
Konstantin
More information about the Interest
mailing list