Memory profile

Maksim Lin maksim at swin.edu.au
Tue Jan 26 17:44:05 PST 1999


Hi Maxim,
I thought I was going crazy when I recently had a look at kaffe's mem
usage and found it had gone back up to what it had been prior to the
inflate bug being fixed a few months ago, now it looks like you have
rediscovered it - I think anyway, I don't understand the code enough to
know whether what you've found is the same as before, but below is the
fix that was sent to the list, so maybe you can figure out whats going
on and let me know :-).

========START OLD MESSAGE (DATED 12/8/98)==========================

I found a bug in inflate_free in inflate.c.
In profiling Kaffe, I found Kaffe consumed about 4MB more memory 
for compressed class library than non-compressed.
Kaffe doesn't free alloced memory for inflate.

Jongwon Kim

-----------------------------------------------------------------

int
inflate_free(inflateInfo* pG)
{
#ifndef BUG_FIX 
  if (pG->fixed_tl != 0)
  {
    huft_free(pG->fixed_td);
    huft_free(pG->fixed_tl);
    pG->fixed_td = pG->fixed_tl = 0;
    gc_free_fixed(pG->slide);
  }
#else
  if (pG != 0) {
   if (pG->fixed_tl != 0) {
  huft_free(pG->fixed_td);
  huft_free(pG->fixed_tl);
   }
     gc_free_fixed(pG->slide);
   gc_free_fixed(pG);
  }
#endif

  return 0;
}

====================END OLD
MESSAGE============================================


Maxim Kizub wrote:
> 
> Hello.
> 
> I've found memory leak.
> 
> It's in kaffe/kaffevm/inflate.c :
> 
> int
> inflate_free(inflateInfo* pG)
> {
>   if (pG->fixed_tl != 0)
>   {
>     huft_free(pG->fixed_td);
>     huft_free(pG->fixed_tl);
>     pG->fixed_td = pG->fixed_tl = 0;
>     KFREE(pG->slide);
>   }
>   KFREE(pG);
> 
>   return 0;
> }
> 
> needs to be:
> 
> int
> inflate_free(inflateInfo* pG)
> {
>   if (pG->fixed_tl != 0)
>   {
>     huft_free(pG->fixed_td);
>     huft_free(pG->fixed_tl);
>     pG->fixed_td = pG->fixed_tl = 0;
>   }
>   KFREE(pG->slide);
>   KFREE(pG);
> 
>   return 0;
> }
> 
> The most strange thing, is that it saves me not
> only those 6Mb it was eating, but allowed to GC
> about 1.5 times more objects. Since block allocated
> by KMALLOC should not be scanned by GC for
> object references - this is really strange...
> 
> PS There was a bug reported early, about memory leak
> in something releted to zip files...
> I can't find it in my archive... Was it really
> fixed? Or I have refound it?
> 
> Regards
>   Maxim Kizub

So is this a regression ???

Maksim.

-- 
Maksim Lin

"...handing C++ to the average programmer seems roughly comparable to
handing a loaded .45 to a chimpanzee."
                                                          -- Ted Ts'o


More information about the kaffe mailing list