Wireshark mailing list archives

Re: Why are ett[] arrays static?


From: Jeff Morriss <jeff.morriss.ws () gmail com>
Date: Fri, 19 Oct 2018 15:05:07 -0400

On Fri, Oct 19, 2018 at 2:27 PM Jakub Zawadzki <darkjames-ws () darkjames pl>
wrote:

W dniu 2018-10-19 16:51, Jeff Morriss napisaƂ(a):
Is it just me or is there no reason for ett[] arrays:

    /* Setup protocol subtree array */
    static gint *ett[] = {
        &ett_PROTOABBREV

to be static?

It seems to me that making it static is just wasting space (keeping the
array around forever)?

If you make it not static, it will waste memory and CPU by having &
running code to initialize this array.

My compiler (gcc 7.3.0-16ubuntu3) with >= 32 etts, after removing static
makes array in .data, but copies it during function execution.


Good point, thanks!
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe

Current thread: