ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

Ethereal-dev: Re: [Ethereal-dev] Freeing memory on exit?

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Wed, 20 Aug 2003 10:26:56 -0700

On Wednesday, August 20, 2003, at 8:07 AM, Lars Ruoff wrote:

Is there a mechanism in Ethereal to call a user-specified function just
before Ethereal exits?

I guess you could use "atexit()", at least on those platforms that support ANSI C. ("ANSI C" here doesn't mean "function prototypes", it means "all of ANSI X3.159-1989, or the ISO equivalent, or the later C99 standard. complete with library routines".)

However:

In some module i am coding, i'm allocating free store, which has to be
persistent during the whole ethereal session and which i would like to free
on exit.

on, as far as I know, *all* of the platforms on which Ethereal runs, the entire address space of a process is freed when the process exits, so it's not as if memory takes up swap space forever if it's not freed by the application on exit.

Note also that "the whole Ethereal session" could involve more than one capture file, so if it truly has to be persistent during the entire session, that presumably means it'd be used even if you close one capture file and read in a new, completely-unrelated, capture file.