.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Cyborg Factory > RealBot > The RealBot 'Source'
The RealBot 'Source' Discuss things about the source code. You can here point out bugs, share ideas and code. Assign to become an 'official team member' and so on!

Reply
 
Thread Tools
memory leak.
Old
  (#1)
Whistler
Summoner
 
Whistler's Avatar
 
Status: Offline
Posts: 1,499
Join Date: Feb 2004
Location: Mist Village
Default memory leak. - 13-07-2004

from nodemachine.cpp file:

Code:
void
cNodeMachine::FreeVisibilityTable (void)
{
  if (cVisTable)
    free (cVisTable);
}
...but I just never find it get called anywhere. and at the start of each map cNodeMachine::init() just malloc() a lot of memory so this may be a memory leak.
  
Reply With Quote
Re: memory leak.
Old
  (#2)
@$3.1415rin
Council Member, Author of JoeBOT
 
@$3.1415rin's Avatar
 
Status: Offline
Posts: 1,381
Join Date: Nov 2003
Location: Germany
Default Re: memory leak. - 13-07-2004

hey stefan, here you might see the advantages of using ctors and dtors


  
Reply With Quote
Re: memory leak.
Old
  (#3)
Josh_Borke
Member
 
Status: Offline
Posts: 152
Join Date: Jun 2004
Default Re: memory leak. - 13-07-2004

another minor leak:
bot.cpp:64:
Code:
char *message = (char *) malloc (64 * sizeof (char));
is never freed
  
Reply With Quote
Re: memory leak.
Old
  (#4)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: memory leak. - 16-07-2004

@Josh, it should be freed when the DLL is unloaded. I am not sure how to do that... Actually thats probably of very old NNBot Ditlew's Radio interception messages and stuff


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: memory leak.
Old
  (#5)
Josh_Borke
Member
 
Status: Offline
Posts: 152
Join Date: Jun 2004
Default Re: memory leak. - 16-07-2004

yea, it's from the radio messages stuff, could you do it in Meta_Detach? along with FreeVisibilityTable? HTH
  
Reply With Quote
Re: memory leak.
Old
  (#6)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: memory leak. - 16-07-2004

doh! Done.


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: memory leak.
Old
  (#7)
Whistler
Summoner
 
Whistler's Avatar
 
Status: Offline
Posts: 1,499
Join Date: Feb 2004
Location: Mist Village
Default Re: memory leak. - 17-07-2004

FreeVisibilityTable should be freed in ServerDeactivate().
and the Meta_Detach() isn't get called if we exit the game normally and not use metamod command to unload the plugin. The correct place to free it is in DllMain() (windows) and _fini() (linux)
also why not use "char message[64];" ? That's exactly same as the malloc thing and we don't need to care about freeing the memory
  
Reply With Quote
Re: memory leak.
Old
  (#8)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: memory leak. - 17-07-2004

I don't know about 'message', it is very (very!) old code i once got from Ditlew (NNBot), so i just litterally took it over. I bet it can be improved here.

Are you sure the memory is not being freed even when exiting the game? How does metamod itself free itself then? (and all its plugins).


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: memory leak.
Old
  (#9)
Whistler
Summoner
 
Whistler's Avatar
 
Status: Offline
Posts: 1,499
Join Date: Feb 2004
Location: Mist Village
Default Re: memory leak. - 17-07-2004

I once added a "assert(false)" in the Meta_Detach() function and only when I use metamod command to unload the plugin it bombs out.
  
Reply With Quote
Re: memory leak.
Old
  (#10)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: memory leak. - 17-07-2004

hmm, well i guess metamod needs some fix up there too then Anyway, thx for the tip! I will work on it when i have time today; i have a lot of cleaning to do before my gf comes by..


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com