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: Guy Harris <guy@xxxxxxxxxxxx>
Date: Sun, 02 Mar 2008 14:44:21 -0800

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.

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.

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

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