Commit Graph

201 Commits

Author SHA1 Message Date
Alexis La Goutte 296591399f Remove all $Id$ from top of file
(Using sed : sed -i '/^ \* \$Id\$/,+1 d')

Fix manually some typo (in export_object_dicom.c and crc16-plain.c)

Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8
Reviewed-on: https://code.wireshark.org/review/497
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04 14:27:33 +00:00
Evan Huus c0a0805dcc Remove emem tree code entirely, it is unused.
Depends on I1cedc611c9b7888eb671cf858c6f7819d37afba9

Change-Id: I5dda2f7c34eacb6f350473791df1d74ea4b4a749
Reviewed-on: https://code.wireshark.org/review/220
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-02-16 04:48:10 +00:00
Evan Huus 18f94609d8 Remove now-unused ephemeral stack code. And another one bites the dust...
svn path=/trunk/; revision=54436
2013-12-24 03:39:19 +00:00
Jakub Zawadzki 62d05c80ff Fix some warnings
svn path=/trunk/; revision=54109
2013-12-14 22:07:26 +00:00
Evan Huus 123caff957 Remove one accidentally remaining reference to emem in XMPP utils.
Kill a bunch of now-unused emem tree code.

svn path=/trunk/; revision=53458
2013-11-21 00:18:12 +00:00
Jakub Zawadzki ae59b09443 Add missing includes in order to remove exceptions.h from proto.h (next commit).
svn path=/trunk/; revision=53230
2013-11-10 15:59:37 +00:00
Pascal Quantin 14fd3d0157 ZeroMemory -> SecureZeroMemory
svn path=/trunk/; revision=52731
2013-10-21 15:16:41 +00:00
Pascal Quantin cf9bbdecef From RobiOneKenobi via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9297 :
Add support for MSVC2013

svn path=/trunk/; revision=52716
2013-10-20 17:35:30 +00:00
Evan Huus 14d589a0a7 Remove some emem functions that have now been completely replaced by wmem.
Finally...

svn path=/trunk/; revision=51757
2013-09-04 21:24:51 +00:00
Jakub Zawadzki 1cabad610b Add some very basic framework to fetch statistics of memory usage per component.
Use it in memory_dlg.

svn path=/trunk/; revision=51069
2013-07-31 18:26:14 +00:00
Chris Maynard 1c19a0d61e Fix warnings: format '%blah' expects argument of type 'foo', but argument 'i' has type 'bar' [-Wformat].
svn path=/trunk/; revision=50639
2013-07-15 21:22:34 +00:00
Evan Huus e13d73e038 Rework wmem scoping limits so that users can still get a handle to a pool when
it is out of scope, they just can't *allocate* in the pool. This is necessary
because file-scope trees (migrating from emem) are set up on program
initialization when there is no file in scope - they need to initialize with the
handle, they just won't use it until a file is actually in scope.

svn path=/trunk/; revision=50046
2013-06-19 18:28:13 +00:00
Evan Huus 526763c293 Fix compilation with SHOW_EMEM_STATS defined.
svn path=/trunk/; revision=49252
2013-05-11 19:40:33 +00:00
Evan Huus b7b30a7cdf More block allocator fixes and cleanup. Most of the issues seem to have been
from one case I consistently forgot when typing it up originally, even though
it's clearly listed several places in my design notes.

Also include an #if0-ed out block of code to redirect emem to wmem for easy
testing (since there are very few common dissectors that use wmem right now).

svn path=/trunk/; revision=48434
2013-03-20 00:04:01 +00:00
Anders Broman 39b85839b1 From beroset:
remove C++ incompatibilities 
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416

svn path=/trunk/; revision=48311
2013-03-15 05:42:24 +00:00
Jakub Zawadzki 85f98b5cfc r30032 again, actually make emem_verify_pointer() works with glib chunks.
after allocating glib chunk, amount_free should be 0,
and free_offset should be set to chunk size.

svn path=/trunk/; revision=48233
2013-03-10 17:49:53 +00:00
Evan Huus 122b7cb6df Remove the emem slab feature (sl_* functions) completely, replacing it with
glib memory slices.

- We weren't doing anything with the emem slab that couldn't be done with glib
  slices.
- Removes a fair bit of code as well as one debugging environment variable.
- Glib slices are much cache-friendlier and are multi-threading friendly (if
  we ever go there).
- Allows glib to actually return slices to the OS on occasion. The emem slab
  would hold onto its memory forever which resulted in a great deal of wasted
  memory after closing a large file.

svn path=/trunk/; revision=48218
2013-03-09 20:02:19 +00:00
Jeff Morriss 99ce4232cb As suggested in comments in sl_alloc() and sl_free(): add a new environment
variable (WIRESHARK_DEBUG_USE_SLICES) which turns off the slab allocator and uses
g_slices instead (which can themselves be turned off by setting
G_SLICE=always-malloc).

This makes debugging problems in slab-allocated memory easier to find
(hopefully including https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8197 ).


Set WIRESHARK_DEBUG_USE_SLICES when running Valgrind on *shark.


Remove unused structure member: emem_chunk_t.org.

svn path=/trunk/; revision=47110
2013-01-16 03:34:29 +00:00
Guy Harris 8ed7a73e22 Fix a bunch of warnings.
Cast away some implicit 64-bit-to-32-bit conversion errors due to use of
sizeof.

Cast away some implicit 64-bit-to-32-bit conversion errors due to use of
strtol() and strtoul().

Change some data types to avoid those implicit conversion warnings.

When assigning a constant to a float, make sure the constant isn't a
double, by appending "f" to the constant.

Constify a bunch of variables, parameters, and return values to
eliminate warnings due to strings being given const qualifiers.  Cast
away those warnings in some cases where an API we don't control forces
us to do so.

Enable a bunch of additional warnings by default.  Note why at least
some of the other warnings aren't enabled.

randpkt.c and text2pcap.c are used to build programs, so they don't need
to be in EXTRA_DIST.

If the user specifies --enable-warnings-as-errors, add -Werror *even if
the user specified --enable-extra-gcc-flags; assume they know what
they're doing and are willing to have the compile fail due to the extra
GCC warnings being treated as errors.

svn path=/trunk/; revision=46748
2012-12-26 05:57:06 +00:00
Anders Broman f5226f1310 From Bill Parker:
Add error handler to munmap() failure in emem.c

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7850

svn path=/trunk/; revision=45915
2012-11-05 09:04:53 +00:00
Jakub Zawadzki f68020f1e1 Revert changes to ep_ allocator, revert edt ref-counting.
svn path=/trunk/; revision=45451
2012-10-10 19:05:30 +00:00
Jakub Zawadzki 174dabeeca Fix r45445
svn path=/trunk/; revision=45446
2012-10-10 12:30:53 +00:00
Jakub Zawadzki c24a90f49e Fix bug #7814
We need to pass original pointer and length to munmap().

svn path=/trunk/; revision=45445
2012-10-10 12:24:56 +00:00
Evan Huus fd76b098a3 Temporarilly disable ep's use of chunks until the bugs are fixed.
svn path=/trunk/; revision=45444
2012-10-10 11:17:28 +00:00
Evan Huus b01f1d3762 Actually destroy chunks in emem_free_all. We lose the efficiency of re-using
them, but until I can figure out the correct logic for that (3rd try and
counting...) this at least plugs the leak.

svn path=/trunk/; revision=45412
2012-10-08 22:27:03 +00:00
Evan Huus 693ed306d3 Try to clarify some of the ifdefs in emem.c.
svn path=/trunk/; revision=45404
2012-10-08 19:43:03 +00:00
Guy Harris e6616b7c2f Rename emem_header_t to emem_pool_t to better indicate what it can be
used for - it represents a memory pool that parcels out memory from
larger allocated chunks (reducing the number of individual malloc-style
calls that are made) and that can be freed in its entirety.

svn path=/trunk/; revision=45400
2012-10-08 18:33:00 +00:00
Gerald Combs 98d7549953 We've already typedef'ed emem_header_t in emem.h. We don't have to do it
again in emem.c.

svn path=/trunk/; revision=45396
2012-10-08 17:52:42 +00:00
Evan Huus 7c5f2ec024 Write a short essay in a comment explaining the weirdness that is now the
ephemeral allocation logic.

svn path=/trunk/; revision=45392
2012-10-08 16:42:54 +00:00
Evan Huus b6f0d11c6f EDT structures now own their ep_ memory pools. This should finally clean
up the last little bits of:
- https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5284
- https://www.wireshark.org/lists/wireshark-dev/201208/msg00128.html

and possibly part of:
- https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7775

This is a fairly invasive change that required some funky work with linked
lists to avoid changing any of the public ep_* APIs, so if something breaks
blame me :)

svn path=/trunk/; revision=45389
2012-10-08 15:23:36 +00:00
Jaap Keuter c80ed42fc6 Vastly improve the debug presentation( of trees)+.
svn path=/trunk/; revision=45340
2012-10-06 14:35:59 +00:00
Jeff Morriss 3729335973 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45016
2012-09-20 01:48:30 +00:00
Jeff Morriss 42623443ed As suggested by Anatoly in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5699 :
Followup to r44844: use a better cast (intptr_t instead of long long).

svn path=/trunk/; revision=44880
2012-09-11 13:11:33 +00:00
Jeff Morriss 17e7db3bca Attempt to fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5699
and https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5979 : 

Don't cast the buffer address to int on Win32: a 64-bit address won't
fit in an integer.

svn path=/trunk/; revision=44844
2012-09-10 15:18:17 +00:00
Michael Mann 493516fd6c Convert GString to emem_strbuf_t in packet-gadu-gadu.c
Required an additional function, ep_strbuf_append_unichar, in emem module

svn path=/trunk/; revision=44564
2012-08-18 19:20:31 +00:00
Gerald Combs 5107d75c82 Try to fix a compiler warning.
svn path=/trunk/; revision=44408
2012-08-09 22:45:43 +00:00
Gerald Combs 097f33c41d Iterate over the emem_tree_*32_array key data instead of using
recursion. I've only done minimal testing but it seems to work OK.

svn path=/trunk/; revision=44401
2012-08-09 21:46:34 +00:00
Michael Mann 05a305d332 Make emem_tree_*32_array functions non-destructive. The following dissectors/files have affectively been bugfixed by the change:
packet-classicstun.c
packet-reload-framing.c (probably)
packet-reload.c
packet-sccp.c
packet-sua.c
packet-tcp.c
packet-xmcp.c
\epan\gcp.c

The following files unnecessarily recreate keys because of the previously destructive nature of emem_tree_*32_array functions:
packet-btl2cap.c
packet-nfs.c
packet-rpc.c
packet-scsi-osd.c
packet-stun.c (per Bug 7569)

These could be cleaned up, but it's not like the key recreation is burning CPU cycles.

svn path=/trunk/; revision=44380
2012-08-09 13:59:29 +00:00
Anders Broman 1ae38887b6 From Evan Huus:
Grab-bag of unused variables.

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7452

svn path=/trunk/; revision=43616
2012-07-09 01:49:02 +00:00
Jakub Zawadzki bf81b42e1e Update Free Software Foundation address.
(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536
2012-06-28 22:56:06 +00:00
Jeff Morriss 06bb167824 The rest of the fix for https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7221
(emem alignment problems on SPARC) :

Have emem use 8-byte alignment when we need it.

Since I can't seem to write code that which reliably (across GCC versions and
optimization levels) determines if 8-byte alignment is needed for doubles,
"when" is defined as "if we're compiling for a CPU other than i386."

Windows doesn't need a check because it's either i386 or 64-bit (x86_64 or
maybe ia64--both of which get 8-byte alignment from G_MEM_ALIGN).

(And, yes, all of this is ignoring the 16-byte alignment requirements of long
doubles.)

svn path=/trunk/; revision=42431
2012-05-04 21:56:32 +00:00
Jeff Morriss 652349d0a5 Partial fix for https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7221
(emem alignment problems on SPARC) :

Add the room for the pointer to the next (from r31577) *before* calculating
the canary+pad: that way the complete allocation
(allocation+canary_ptr+canary+pad) will end on an 8-byte boundary (as was the
case before r31577).

This only solves the alignment problem when using canaries (i.e., not, by
default, se_ allocations).

(And, yes, this is ignoring the 16-byte alignment requirements of long
doubles.)

svn path=/trunk/; revision=42407
2012-05-04 01:33:58 +00:00
Jakub Zawadzki 4f3e8427f3 Revert r42001
svn path=/trunk/; revision=42013
2012-04-10 20:58:14 +00:00
Jakub Zawadzki 743fe89dc7 If scrubbing memory is set, during alloc we can check if memory is still scrubbed.
This should at least show problems with ep_ use in packet-infiband.c

svn path=/trunk/; revision=42001
2012-04-09 22:31:41 +00:00
Jeff Morriss a94c84d34f Add a new environment variable (WIRESHARK_ABORT_ON_OUT_OF_MEMORY) that
prevents OutOfMemory exceptions from being thrown.  This makes it easier
to debug such conditions.

Set this variable in test-fuzzed-cap.sh but not in fuzz-test.sh; it's nice
to see the friendly out-of-memory error message in the bug reports the
latter script generates.

svn path=/trunk/; revision=41656
2012-03-19 02:00:42 +00:00
Bill Meier 781129806f Fix ex "modeline" so it works;
See https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5748

svn path=/trunk/; revision=39081
2011-09-21 17:49:11 +00:00
Jakub Zawadzki 17f6352c2e Convert SLAB_-s, to sl_-API.
svn path=/trunk/; revision=37030
2011-05-09 12:52:55 +00:00
Jakub Zawadzki 99351cb0e3 Initial commit of slab allocator (sl_* API)
svn path=/trunk/; revision=37027
2011-05-09 08:55:35 +00:00
Jakub Zawadzki 19ee373ba9 Cleanup emem_verify_pointer()
svn path=/trunk/; revision=36800
2011-04-22 12:25:01 +00:00
Guy Harris 384d06a027 Either the buf argument to emem_scrub_memory() is properly aligned or it
isn't.  If it is, we don't need to worry about alignment, so the XXX
comment doesn't belong there; if it isn't, then we should do what the
comment says.  For now, assume the comment before the XXX comment is
correct, and just cast away the alignment warning.

svn path=/trunk/; revision=36795
2011-04-22 04:01:30 +00:00