Re: Memory allocation troubles
- From: Paul Pogonyshev <pogonyshev gmx net>
- To: Olaf FrÄczyk <olaf cbk poznan pl>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Memory allocation troubles
- Date: Tue, 19 Oct 2004 18:24:18 +0300
Olaf FrÄczyk wrote:
Hi,
I write an application that requires much memory to run.
It is impossible to assume that every time I ask for memory I'll get it.
The application creates many threads (up to several hundreds) each
thread taking about 0,6 MB.
And when I am out of memory I could just wait for some threads to
finish, and try again.
Aborting program is not an option, because before dying I need to clean
things up.
As I understand, when I create a widget, add a timer etc. I allocate
some memory. But in the API description there is nothing said that on
return I should get NULL value or something.
In other place I have found, that the glib library just aborts the
program if it is unable to allocate memory. As gtk is build on top of
glib, should I assume that there is no out of memory handling in gtk
also?
While I'm unable to help you here, I'd like to note that running out
of memory is a generally bad idea according to my experience. I once
had such a situation where my program under Valgrind consumed all
available RAM and swap and Valgrind bailed out. After this, X server
had had problems with fonts till I restarted it (and their might have
been more little problems, don't remember.)
So, you might consider limiting memory usage of your program instead.
Or watch that there is still a "reasonable" amount of memory available
for the system (not sure how to do this, though.)
Paul
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]