Wireshark

  • Riverbed Technology
  • WinPcap
the world's foremost network protocol analyzer
  • Wireshark
    • About
    • Download
    • Blog
  • Get Help
    • Ask a Question
    • FAQs
    • Documentation
    • Mailing Lists
    • Online Tools
    • Wiki
    • Bug Tracker
  • Develop
    • Get Involved
    • Developer's Guide
    • Browse the Code
    • Latest Builds

Wireshark-dev: Re: [Wireshark-dev] Column data memory allocation - excessive?

Date Index Thread Index Other Months All Mailing Lists
Date Prev Date Next Thread Prev Thread Next


From: Stephen Fisher <stephentfisher@xxxxxxxxx>
Date: Sun, 2 Mar 2008 16:20:37 -0700

On Sun, Mar 02, 2008 at 02:44:21PM -0800, Guy Harris wrote:
> Stephen Fisher wrote:
> > One place where there are a lot of calls to the unsafe strcpy() is 
> > epan/column-utils.c.  However, before replacing them with g_strpcpy(), I 
> > wanted to ask if there is any reason we can't start using dynamic memory 
> > allocation in those places (as Guy recently suggested) instead of 
> > g_strlcpy()?
> 
> I'm not sure I'd suggested that - I've mainly been concerned about the 
> memory allocation internal to GTK+ for the column displays, rather 
> than stuff Wireshark itself allocates.

Oh, ok.

> > We are allocating full field widths worth of memory for every column 
> > (256 bytes each) plus the info column (4096 bytes each) for every row in 
> > the build_column_format_array() function (in epan/column.c) ahead of 
> > time and then strcpy() data into them.
> 
> For every row?  I might be misremembering, but I think only one set of 
> column string buffers are allocated at start-up time, and those 
> buffers are reused.

Whew!  You're right.  Thanks for the insight.  I'll go ahead and convert 
strcpy() to g_strlcpy() in epan/column-utils.c then.


Steve


  • References:
    • [Wireshark-dev] Column data memory allocation - excessive?
      • From: Stephen Fisher
    • Re: [Wireshark-dev] Column data memory allocation - excessive?
      • From: Guy Harris
  • Prev by Date: Re: [Wireshark-dev] [Wireshark-bugs] [Bug 1715] Memory consumes more and more while reopening pcap files
  • Next by Date: Re: [Wireshark-dev] [Wireshark-bugs] [Bug 1715] Memory consumes more and more while reopening pcap files
  • Previous by thread: Re: [Wireshark-dev] Column data memory allocation - excessive?
  • Next by thread: Re: [Wireshark-dev] [Wireshark-bugs] [Bug 1715] Memory consumes more and more while reopening pcap files
  • Index(es):
    • Date
    • Thread

Wireshark and the "fin" logo are registered trademarks of the Wireshark Foundation