Login
User Name:

Password:



Register

Forgot your password?
do_owhere recursive
Author: Khonsu
Submitted by: Khonsu
Changes list / Addchange
Author: Khonsu
Submitted by: Khonsu
6Dragons mp3 sound pack
Author: Vladaar
Submitted by: Vladaar
AFKMud 2.2.3
Author: AFKMud Team
Submitted by: Samson
SWFOTEFUSS 1.5
Author: Various
Submitted by: Samson
Users Online
AhrefsBot, Bing

Members: 0
Guests: 28
Stats
Files
Topics
Posts
Members
Newest Member
489
3,791
19,644
596
Elwood

Today's Birthdays
There are no member birthdays today.
» SmaugMuds » General » Smaug Snippets » I3 Snippet
Forum Rules | Mark all | Recent Posts

I3 Snippet
< Newer Topic :: Older Topic > Massive memory usage +200MB of RAM

Pages:<< prev 1 next >>
Post is unread #1 Sep 22, 2016 1:06 am   
Go to the top of the page
Go to the bottom of the page

Kasji
Apprentice
GroupMembers
Posts63
JoinedDec 23, 2007

 
So the I3 snippet I've added to my mud is doing something weird. Originally it was fine, but now it is using ridiculous amounts of RAM.

Each time I copyover, the RAM usage increases by over 200MB. Earlier today RAM usage was at over 1.2GB.

Upon investigation, I found that the file i3.channels is a whopping 60MB.

It would seem that the two are related.

Post is unread #2 Sep 22, 2016 8:56 pm   
Go to the top of the page
Go to the bottom of the page

Guest - (Unregistered)

 
Kasji,

You probably already did this, but did you try commenting out i3 in makefile and see if copyover still gives the ram issues?

Post is unread #3 Sep 23, 2016 11:35 pm   Last edited Sep 23, 2016 11:35 pm by Kasji
Go to the top of the page
Go to the bottom of the page

Kasji
Apprentice
GroupMembers
Posts63
JoinedDec 23, 2007

 
Yeah, that's the first thing I did. Mud runs at about 11MB RAM usage without I3.

Edit: Copyover doesn't increase RAM usage with I3 commented out.

Post is unread #4 Sep 24, 2016 8:02 am   
Go to the top of the page
Go to the bottom of the page

Quixadhal
Conjurer
GroupMembers
Posts398
JoinedMar 8, 2005

 
My random guess would be that you aren't handling the existing socket (and the data already loaded), and are simply opening a new I3 connection on copyover, which would then duplicate the data as it re-initializes.

My own MUD doesn't have copyover/hotboot, but I have a modified SmaugFUSS version on github that does. Basically, you have to add the I3 socket descriptor to the arguments used when re-invoking the executable so it can restore the original socket without disruption.

Otherwise, make SURE you do an I3 disconnect before doing the copyover, and reconnect again afterwards. If you do it that way, make sure you don't reboot too frequenly (like every minute), or the I3 server may kick you for spamming the startup packet.

Post is unread #5 Sep 25, 2016 9:32 pm   Last edited Sep 25, 2016 9:40 pm by Vladaar
Go to the top of the page
Go to the bottom of the page

Guest - (Unregistered)

 
Just curious did you use the instructions for smaug that dealt with copyover? I noticed it didn't have anything for copyover.c I added what I have in my copyover.c maybe that will complete it for you. LoL, nevermind I just scrolled all the way down the snippet and it does address copyover.c or hotboot.c file. The below is what mine looks like currently.



// In copyover.c find

  log_string("Executing copyover....");

  /*
   * added this in case there's a need to debug the contents of the various files 
   */
  if(argument && !str_cmp(argument, "debug"))
  {
    log_string("Copyover debug - Aborting before execl");
    return;
  }

// add this

#ifdef I3
  if(i3_is_connected())
  {
    i3_save_chanlist();
    i3_save_mudlist();
    i3_save_history();
  }
#endif

// Next find
#ifdef IMC
  if(this_imcmud)
    snprintf(buf3, 100, "%d", this_imcmud->desc);
  else
    strncpy(buf3, "-1", 100);

// Add right below

#ifdef I3
  snprintf(buf4, 100, "%d", I3_socket);
#else  
  strncpy(buf4, "-1", 100);
#endif 
#else
#ifdef I3
  snprintf(buf3, 100, "%d", I3_socket);
#else
  strncpy(buf3, "-1", 100);
#endif
  strncpy(buf4, "-1", 100);
#endif

// Next find

  log_string("Copyover recovery complete.");

  get_curr_players();

// Add this

#ifdef I3
  /*
   * Initialize and connect to I3
   */  
  i3_startup(FALSE, port, 0);

#endif 

Post is unread #6 Sep 26, 2016 2:31 am   Last edited Sep 26, 2016 2:34 am by Kasji
Go to the top of the page
Go to the bottom of the page

Kasji
Apprentice
GroupMembers
Posts63
JoinedDec 23, 2007

 
There was a copyover portion in the snippet I followed. It has everything you've got there, except for one thing is different.
i3_startup(FALSE, port, 0);

is actually:
i3_startup(FALSE, port, fCopyOver);


fCopyOver is a bool for telling if there was a copyover during startup. I think that I'm facing two separate issues though. The RAM usage increase from copyovers is one thing, and the massive RAM usage period is another issue. I3 still uses over 200MB of RAM on a fresh startup. I figured it had to be related to the i3.channels file being over 60MB in size.

EDIT: I should also note that I am using g++ and std=c++11

Pages:<< prev 1 next >>