Jump to content


Photo

lots of memory leaks


  • Please log in to reply
12 replies to this topic

#1 jz

jz
  • Members
  • 13 posts

Posted 10 October 2005 - 03:32 AM

So today I decided to add FastMM4 to a small project that uses the berg components and it quickly found all sorts of leaks sad.gif

In about 15 minutes I tracked these down:


CODE
constructor TNxPageControl.Create(AOwner: TComponent);

begin

...

 FCloseBtnBitmap := TBitmap.Create; // never released





constructor TNxLinkLabel.Create(AOwner: TComponent);

begin

...

 FGlyph := TBitmap.Create; // never released





constructor TNxHeaderPanel.Create(AOwner: TComponent);

begin

...

 FHeaderFont := TFont.Create; // never released

 FGlyph := TBitmap.Create; // never released





constructor TNxFlipPanel.Create(AOwner: TComponent);

begin

...

 FMargins := TNxMargins.Create; // never released





constructor TNxFlipContainer.Create(AOwner: TComponent);

begin

...

 FCanvas := TControlCanvas.Create; // never released





constructor TNxGlyphButton.Create(AOwner: TComponent);

begin

...

 FBufferBitmap := TBitmap.Create; // guess!

 FDownImage := TBitmap.Create;

 FHoverImage := TBitmap.Create;

 FImage := TBitmap.Create;




I'm sure there are many more but I got bored looking for them after I noticed a disturbing pattern: you don't even bother to code destructors for many classes!!

I suggest you download FastMM4 (it's free and open source) and compile it into all of your demo programs which make heavy use of the components (and generate lots of leaks). I sincerly hope the next release will not have any leaks at all.

#2 Raymond

Raymond
  • Members
  • 36 posts

Posted 11 October 2005 - 02:53 AM

Is this the MM on sourceforge?

Can you provide a link?

Thanks,
-Raymond

#3 jz

jz
  • Members
  • 13 posts

Posted 11 October 2005 - 08:01 AM

http://sourceforge.n...rojects/fastmm/

When you exit your program it will tell you how much memory was leaked.

#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 12 October 2005 - 12:56 AM

Hello,

I will fix them all. And I will download this prog for sure! Thanks.

regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#5 Raymond

Raymond
  • Members
  • 36 posts

Posted 13 October 2005 - 02:13 AM

Are you going to download the older stable 4.27 release

or the newer beta release 4.35???


Thanks,
-Raymond

#6 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 13 October 2005 - 01:23 PM

Hello,

I have download version 4.35. I only now need to learn how to use it smile.gif

regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#7 Raymond

Raymond
  • Members
  • 36 posts

Posted 13 October 2005 - 04:23 PM

LOL! laugh.gif

I understand all too well...

Thanks for the info, looks interesting!

-Raymond

#8 wvd_vegt

wvd_vegt

    Master Member

  • Honorable Members
  • PipPipPipPipPip
  • 710 posts
  • Gender:Male
  • Location:the Netherlands

Posted 19 October 2005 - 03:59 PM

Hi,

Perhaps interesting to a few of us: MemCheck a tool I used for quite some time to trace leaks, found at

http://v.mahon.free....eware/memcheck/

Unlike FastMM it does't replace the Borland Memory Manager but sits in between the Memory Manager and the Application and monitors all (de)allocations made.
G.W. van der Vegt

#9 Raymond

Raymond
  • Members
  • 36 posts

Posted 20 October 2005 - 01:30 AM

Thanks Wim!!!

As my eyes get older... these tools can be of more help! laugh.gif

-Raymond

#10 daniel_r

daniel_r
  • Members
  • 29 posts

Posted 20 October 2005 - 05:43 PM

Hello,

QUOTE
Unlike FastMM it does't replace the Borland Memory Manager but sits in between the Memory Manager and the Application and monitors all (de)allocations made.


That's true, but that has never been the primary purpose of FastMM. FastMM is a memory manager, which is much faster than the RTL MM and - as far as I know - Borland has already agreed to use FastMM in future products. The memory leak checking and the memory corruption checking is really useful, but merely a side-product.

Regards,
Daniel

#11 wvd_vegt

wvd_vegt

    Master Member

  • Honorable Members
  • PipPipPipPipPip
  • 710 posts
  • Gender:Male
  • Location:the Netherlands

Posted 21 October 2005 - 11:14 AM

Hi,

I totally agree with you, I just wasn't to comfortable swapping the Borland thing I'm using for years. Until borland uses it in it's products, I probably only use it for memory checking.

Memcheck therefor is handy for those who want to stick to Borland's but want some checks to be done.

I must say that fastmm4 does track some more bugs down (found some nasty ones in a lanman api where unicode strings where one byte short).
G.W. van der Vegt

#12 jz

jz
  • Members
  • 13 posts

Posted 17 December 2005 - 02:25 AM

Found one more in the lastest version.


constructor TNxGlyph.Create(AOwner: TComponent);
begin
FGlyph := TBitmap.Create; // not released

#13 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 18 December 2005 - 03:39 PM

Hello,

Thank you, I have add it.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users