GTK packet list string chunk fixups.

Call g_string_chunk_clear when we clear the packet list. Allocate 1 MiB
chunks instead of 32 byte chunks. This doesn't do much in practice locally
but appears more correct according to the GStringChunk documentation
and source code.

Change-Id: I143b6e1b48d376ba826cb342ade71085a2d82d96
Reviewed-on: https://code.wireshark.org/review/10344
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
Gerald Combs 2015-09-01 08:28:34 -07:00
parent 0818347d1b
commit 759e618747
1 changed files with 4 additions and 1 deletions

View File

@ -586,6 +586,8 @@ packet_list_store_clear(PacketList *packet_list)
/* Generate new number */
packet_list->stamp = g_random_int();
g_string_chunk_clear(packet_list->string_pool);
#ifdef PACKET_LIST_STATISTICS
g_warning("Const strings: %u", packet_list->const_strings);
packet_list->const_strings = 0;
@ -646,6 +648,7 @@ packet_list_append_record(PacketList *packet_list, frame_data *fdata)
return newrecord->visible_pos;
}
#define PACKET_STRING_CHUNK_SIZE (1 * 1024 * 1024)
static void
packet_list_change_record(PacketList *packet_list, PacketListRecord *record, gint col, column_info *cinfo)
{
@ -719,7 +722,7 @@ packet_list_change_record(PacketList *packet_list, PacketListRecord *record, gin
}
if(!packet_list->string_pool)
packet_list->string_pool = g_string_chunk_new(32);
packet_list->string_pool = g_string_chunk_new(PACKET_STRING_CHUNK_SIZE);
if (!get_column_resolved (col) && cinfo->col_expr.col_expr_val[col]) {
/* Use the unresolved value in col_expr_val */
str = g_string_chunk_insert_const (packet_list->string_pool, (const gchar *)cinfo->col_expr.col_expr_val[col]);