Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
auth_update crash
Dec 23, 2017, 10:15 pm
By Remcon
check_tumble
Dec 18, 2017, 7:21 pm
By Remcon
parse description bug
Dec 15, 2017, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, Yandex, Yahoo!

Members: 0
Guests: 6
Stats
Files
Topics
Posts
Members
Newest Member
478
3,708
19,242
612
Jacki72H
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » General » Coding » Leaks
Forum Rules | Mark all | Recent Posts

Leaks
< Newer Topic :: Older Topic > Valgrind output

Pages:<< prev 1 next >>
Post is unread #1 Sep 10, 2004, 6:03 pm   Last edited Nov 24, 2007, 2:27 pm by Samson
Go to the top of the page
Go to the bottom of the page

cynshard

GroupMembers
Posts95
JoinedNov 19, 2003

I'm working with the following functions:

/* Get Offline characters based on do_loadup --Cynshard */
CHAR_DATA* get_char2( CHAR_DATA *ch, char *argument )
{
	CHAR_DATA *temp;
	char fname[256];
	struct stat fst;
	DESCRIPTOR_DATA *d;
	ROOM_INDEX_DATA *temproom, *original = NULL;

	if( !argument || argument[0] == '\0' )
  return ch;

	if( ch && ( temp = get_char_world( ch, capitalize( argument ) ) ) != NULL && !IS_NPC( temp ) )
	{
  temp->pcdata->loaded = FALSE;
  return temp;
	}

	temproom = get_room_index( ROOM_VNUM_LIMBO );
	if( !temproom )
	{
  bug( "%s", "Get_char2: Limbo room is not available!" );
  send_to_char( "Fatal error, report to the immortals.\r\n", ch );
  return NULL;
	}

	argument[0] = UPPER(argument[0]);
	snprintf( fname, 256, "%s%c/%s", PLAYER_DIR, tolower(argument[0]), capitalize( argument ) );

	/* Bug fix here provided by Senir to stop /dev/null crash */
	if ( stat( fname, &fst ) == -1 || !check_parse_name( capitalize( argument ), FALSE ) )
  return NULL;

	if( stat( fname, &fst ) != -1 )
	{
  CREATE( d, DESCRIPTOR_DATA, 1 );
  d->next = NULL;
  d->prev = NULL;
  d->connected = CON_PLOADED;
  d->outsize = 2000;
  CREATE( d->outbuf, char, d->outsize );

  // Prevent Build Log from Spamming
  getchar_flag = TRUE;

  load_char_obj( d, argument, FALSE, FALSE );

  LINK( d->character, first_char, last_char, next, prev );

  temp = d->character; // Hope this works...
  temp->pcdata->loaded = TRUE;

  original = d->character->in_room;
  if( !char_to_room( d->character, temproom ) )
  	log_printf( "char_to_room: %s:%s, line %d.", __FILE__, __FUNCTION__, __LINE__ );

  /* Save for later --Cynshard */
  temp->orig_room = original;

  d->character->desc	= NULL;
  d->character  = NULL;
  DISPOSE( d->outbuf );
  DISPOSE( d );
  return temp;
	}
	/* else no player file */
	return NULL;
}


/* A no-echo quit wrapper --Cynshard */
void todo_quit( CHAR_DATA *ch )
{
	if( ch->pcdata->loaded == FALSE || IS_CH_ONLINE( ch ) )
  return;

	int x, y;
	ROOM_INDEX_DATA *original;
	original = ch->orig_room;

	char_from_room( ch );
	if( !char_to_room( ch, original ) )
  log_printf( "char_to_room: %s:%s, line %d.", __FILE__, __FUNCTION__, __LINE__ );

	quitting_char = ch;

	nullify_temp_todo( ch );

	if( sysdata.save_pets )
	{
  CHAR_DATA *pet;

  while( ( pet = ch->last_pet ) != NULL )
  	extract_char( pet, TRUE );
	}
	saving_char = NULL;

	/*
	* After extract_char the ch is no longer valid!
	*/
	extract_char( ch, TRUE );
	for ( x = 0; x < MAX_WEAR; x++ )
  for ( y = 0; y < MAX_LAYERS; y++ )
  	save_equipment[x][y] = NULL;

	return;
}


That load characters up and quit them. I'm experiencing leaky behavior from my copy of afkmud, and I'm almost positive the leaks are within these functions or the way in which I call them. I have a rather lengthy valgrind output so I've put in in a text file and made it available here.

Thanks,
Cynshard
       
Post is unread #2 Sep 12, 2004, 1:14 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

Your Valgrind output makes no sense. It looks like you tried to run a copyover while doing this, which if I'm not mistaken is a bad idea because it will mess up the results you get
       
Pages:<< prev 1 next >>