Re: Memory allocation troubles



Hello Olaf,

Paul Pogonyshev <pogonyshev gmx net> 2004-10-19 11:24:18 >>>
Olaf Fr*czyk wrote:
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?

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.)

Like you I would like to have some idea how much memory 
is available and gracefully stop the application before 
the integrity of the operating system is affected.

In my case I'm trying to come up with some sort of stradegy 
for understanding and dealing with how much glib memory 
is in use by Ethereal with the GTK2 running on Windows XP.  

It's been my experiance that Windows systems don't handle 
running low on memory very gracefully either. I seem to 
remember Windows popping up some sort of dialog about 
"Running dangerously low on resources."  If you are quick 
enough and clever enough (e.g. having the Task Manager
up and running in "Always on top" mode), you can often kill 
off the memory hogging application (in my case Ethereal) 
before the system becomes totally unstable.   

I've been looking at (but have not yet had a chance to play 
with) the g_mem_profile() function documented in the glib 
Memory Allocation api reference at:

  http://developer.gnome.org/doc/API/2.0/glib/glib-Memory-Allocation.html 

I'm not sure how expensive in terms application processing 
speed enabling the glib memory profiler would be.  My past 
experience with profilers is that they invariably do impact 
performance, but the performance impact may be acceptable 
given the additional visability.  I think the glib profiler may 
be promising avenue to explore.

I hope you find the above information useful.

Best regards,

Jim Young





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]