2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-13 12:22:17 +00:00

Boost Jam now correctly reports its dangling string object count when displaying DEBUG_MEM messages independent of whether it is configured to use its hash-table OBJECT cache implementation or not.

[SVN r79258]
This commit is contained in:
Jurko Gospodnetić
2012-07-04 09:40:11 +00:00
parent b9ed6db9e3
commit ac84e70307

View File

@@ -248,19 +248,22 @@ static void object_validate( OBJECT * obj )
OBJECT * object_new( char const * string )
{
#ifdef BJAM_NO_MEM_CACHE
int const len = strlen( string ) + 1;
struct hash_item * const m = (struct hash_item *)BJAM_MALLOC( sizeof( struct
hash_header) + len );
++strcount_in;
strtotal += len;
memcpy( m->data, string, len );
m->header.magic = OBJECT_MAGIC;
return (OBJECT *)m->data;
#ifdef BJAM_NO_MEM_CACHE
{
int const len = strlen( string ) + 1;
struct hash_item * const m = (struct hash_item *)BJAM_MALLOC( sizeof(
struct hash_header ) + len );
strtotal += len;
memcpy( m->data, string, len );
m->header.magic = OBJECT_MAGIC;
return (OBJECT *)m->data;
}
#else
if ( !strhash.data )
string_set_init( &strhash );
++strcount_in;
return (OBJECT *)string_set_insert( &strhash, string );
#endif
}
@@ -374,8 +377,8 @@ void object_done()
if ( DEBUG_MEM )
{
printf( "%dK in strings\n", strtotal / 1024 );
/* if ( strcount_in != strcount_out )
if ( strcount_in != strcount_out )
printf( "--- %d strings of %d dangling\n", strcount_in -
strcount_out, strcount_in ); */
strcount_out, strcount_in );
}
}