Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Ethereal-dev: Re: [Ethereal-dev] Proposal for mew memory allocation API

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

From: didier <dgautheron@xxxxxxxx>
Date: Wed, 06 Jul 2005 04:12:41 +0000
ronnie sahlberg wrote:
List

Attached are two new files with a new FAST api to provide memory
allocation and automatic garbage collection with an allocation
lifetime of
either    until-next-packet
or until-next-capture-file


The functions are very very simple and should be fast. If used
properly we should also get rid of all memory leaks.


The purpose of these functions is twofold:
1, to speed up memory allocation
2, to reduce the probability of memory leaks.


Two areas where functions such as these could immediately benefit are the

1, Packet lifetime : silly things such as
 cur_idx++;
  if(cur_idx>3){
     cur_idx=0;
  }
  cur=&str[cur_idx][0];

Yes this one is really bad.
BTW there's a bug in packet-eth.c around line 300
ti = proto_tree_add_protocol_format(parent_tree, proto_eth, tvb, 0, ETH_HEADER_SIZE,

Without Mac resolution get_ether_name *is* ether_to_str so it pushes four ether_to_str results but there's only 3 buffers...

Didier