Re: [gtk-list] Re: memory leak GtkText




Teemu Kalvas, on  5/7/1998, wrote the following:
> 
> Jason Nordwick <nordwick@scam.XCF.Berkeley.EDU> writes:
> 
> > Teemu Kalvas, on  5/7/1998, wrote the following:
> > > 
> > > I tested this with a shorter program which just repeatedly puts random
> > > lines into the text widget and then takes them away, and it seems that
> > > the memory use of the program rises every time text is added but never
> > > goes down when text is removed.  So I conclude that there must be a
> > > memory problem with GtkText.
> > > 

I just ran it through for awhile and never saw the problem.
There were 50 inserts and deletes done between each of these intervals
(done by add/delete x 50, not grouped).

 7113 nordwick   2   0   428K  1368K select   0:00  0.00%  0.00% gtk-test
 7113 nordwick   2   0   428K  1368K select   0:00  0.00%  0.00% gtk-test
 7113 nordwick   2   0   428K  1340K select   0:00  0.00%  0.00% gtk-test
 7113 nordwick   2   0   428K  1324K select   0:00  0.00%  0.00% gtk-test

However when I group adds, then do one delete at the end I get this:

 7113 nordwick   2   0   444K  1352K select   0:00  0.00%  0.00% gtk-test

I think this is just because the realloc of the ->text buffer needs to
go get more memory of page alignment... no bug deal, because free
wont return it to the OS, just keep it for later use.  I can then
go up to a buffer of over 10k before the segment grows by another 16k.

I think :)

(p.s., This is all done on FreeBSD-current so your millage may vary)

Jay
-- 
Join the FreeBSD Revolution.
Support the FSF, buy GNU.
http://xcf.berkeley.edu/



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