How to handle Out-of-Memory in Konqueror?

Stefan Taferner taferner at kde.org
Wed Feb 25 09:55:54 GMT 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wednesday 25 February 2004 10:44, Josef Weidendorfer wrote:
> Hi,
>
> I need your advice. Bug [75775] (konqueror fsview part crashes when viewing
> a large directory) comes from an out of memory condition. The backtrace
> shows that the crash is an abort(), triggered by raising an out-of-memory
> exception in new().
>
> How to cope with this in a graceful way?
>
> Of course, I'm thinking about using less memory resources in fsview
> (currently around 600 Bytes per file). But if someone looks at the root
> directory of a file server, there will always be the possibility for this
> out-of-memory condition.

Unix does usually not care about out-of-memory, as it usually does
not happen. When your swap is used up the machine is swapping around
anyways, which makes it rather unusable.

> First thing: I will have to catch the exception? Or is it enough to check
> for zero as return value from new() ?

If an exception is thrown you have to catch it.

> Next: Does it help in this case to free as many objects as possible before
> showing a notification in message box, or is the process doomed to fail
> anyway?

You would have to guard all object creations (new-s) to be 100% safe, as it 
might happen elsewhere too. This is probably lots of work and not worth
the effort.

You could catch the exception on an outer level, popup a dialog, and
thats it. You cannot throw exceptions over Qt slots, but you probably 
know that ;-)

Kind regards,
Stefan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQFAPHEtyFGHHVZzCLwRAqvzAKCoLVk0NSlwgCzPyyd6c7HM9QinrwCcCZ/v
1AmMgqjiVvPOkIKfsGcbsuc=
=dXU5
-----END PGP SIGNATURE-----




More information about the kde-core-devel mailing list