Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
tintin++ ogg sound player script for linux
Author: Robert Smith
Submitted by: Vladaar
6Dragons ogg Soundpack
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
Users Online
CommonCrawl, Bing, Yandex, DotBot, Google

Members: 0
Guests: 14
Stats
Files
Topics
Posts
Members
Newest Member
481
3,735
19,370
618
Micheal64X
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,643
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 >>