Re: Destroying a window



On Tue, Mar 12, 2002 at 08:47:19PM +0000, Martyn Russell wrote:
On Tue, 2002-03-12 at 20:13, mrl netbank com br wrote:
On Tue, Mar 12, 2002 at 08:05:18PM +0000, Martyn Russell wrote:
On Tue, 2002-03-12 at 19:04, mrl netbank com br wrote:
Do you realy have to free(..) it???

ABSOLUTELY!

Im writing software which responds to telephony events.  In particular I
have a new window for each call that each user has. At any time there
could be 20 users, over the course of the day thats 20 x n (calls).  The
mem not being freed correctly causes a leak of just over 1 meg over the
day.  If it was used in a call centre it would be more serious.
---end quoted text---
Hmmmm.. not realy..
I said the memory is cached, not just loosed..
The next time you call g_malloc(..), eg, call gtk_window_new(..), you'll
probably use this memory again..
I that is the case how is it that there is a mem leak when creating
these dialogs especially since I have spent hours cleaning up my own
code and know that it is not there.
---end quoted text---
hehe, I couldn't undestand again, but let's go..
I can't assume that gtk+ and glib have *no* memory leaks, since I don't code
for it and don't know it's code situation, but I can assume that it almost
doesn't have memory leaks..

and what I said before, was that you created a window, the user finished
using it and closed it, you g_free()d it.. this memory is cached and will be
used again at the next window you open..
so, if you open 20 windows at the same time, glib will malloc() it all and,
may be, i don't know the numbers, it may free() only 10 windows and keep
10 windows on it's cache, to reduce malloc() calls after this but at the same
time release resources to the system..
-- 
Marcelo R Leitner <mrl netbank com br>
ICQ #: 29966851



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