|
From: <sv...@va...> - 2009-05-06 06:45:13
|
Author: njn
Date: 2009-05-06 07:45:05 +0100 (Wed, 06 May 2009)
New Revision: 9783
Log:
Merge r9781 and r9782 (fix quadratic behaviour in Memcheck) from the trunk.
Added:
branches/DARWIN/memcheck/perf/
Removed:
branches/DARWIN/memcheck/tests/mempool.stderr.exp64
Modified:
branches/DARWIN/configure.in
branches/DARWIN/coregrind/m_hashtable.c
branches/DARWIN/include/pub_tool_hashtable.h
branches/DARWIN/include/pub_tool_oset.h
branches/DARWIN/massif/perf/Makefile.am
branches/DARWIN/memcheck/Makefile.am
branches/DARWIN/memcheck/mc_errors.c
branches/DARWIN/memcheck/mc_include.h
branches/DARWIN/memcheck/mc_leakcheck.c
branches/DARWIN/memcheck/perf/many-loss-records.c
branches/DARWIN/memcheck/tests/Makefile.am
branches/DARWIN/memcheck/tests/leak-cases-full.stderr.exp
branches/DARWIN/memcheck/tests/leak-cycle.stderr.exp
branches/DARWIN/memcheck/tests/mempool.c
branches/DARWIN/memcheck/tests/mempool.stderr.exp
Modified: branches/DARWIN/configure.in
===================================================================
--- branches/DARWIN/configure.in 2009-05-06 06:27:19 UTC (rev 9782)
+++ branches/DARWIN/configure.in 2009-05-06 06:45:05 UTC (rev 9783)
@@ -1843,8 +1843,9 @@
memcheck/tests/amd64/Makefile
memcheck/tests/x86/Makefile
memcheck/tests/linux/Makefile
+ memcheck/tests/darwin/Makefile
memcheck/tests/x86-linux/Makefile
- memcheck/tests/darwin/Makefile
+ memcheck/perf/Makefile
memcheck/docs/Makefile
cachegrind/Makefile
cachegrind/tests/Makefile
Modified: branches/DARWIN/coregrind/m_hashtable.c
===================================================================
--- branches/DARWIN/coregrind/m_hashtable.c 2009-05-06 06:27:19 UTC (rev 9782)
+++ branches/DARWIN/coregrind/m_hashtable.c 2009-05-06 06:45:05 UTC (rev 9783)
@@ -190,10 +190,9 @@
return NULL;
}
-/* Allocates a suitably-sized array, copies all the hashtable elements
- into it, then returns both the array and the size of it. This is
- used by the memory-leak detector. The array must be freed with
- VG_(free).
+/* Allocates a suitably-sized array, copies pointers to all the hashtable
+ elements into it, then returns both the array and the size of it. The
+ array must be freed with VG_(free).
*/
VgHashNode** VG_(HT_to_array) ( VgHashTable table, /*OUT*/ UInt* n_elems )
{
@@ -201,12 +200,7 @@
VgHashNode** arr;
VgHashNode* node;
- *n_elems = 0;
- for (i = 0; i < table->n_chains; i++) {
- for (node = table->chains[i]; node != NULL; node = node->next) {
- (*n_elems)++;
- }
- }
+ *n_elems = table->n_elements;
if (*n_elems == 0)
return NULL;
Modified: branches/DARWIN/include/pub_tool_hashtable.h
===================================================================
--- branches/DARWIN/include/pub_tool_hashtable.h 2009-05-06 06:27:19 UTC (rev 9782)
+++ branches/DARWIN/include/pub_tool_hashtable.h 2009-05-06 06:45:05 UTC (rev 9783)
@@ -67,10 +67,9 @@
/* Removes a VgHashNode from the table. Returns NULL if not found. */
extern void* VG_(HT_remove) ( VgHashTable table, UWord key );
-/* Allocates a suitably-sized array, copies all the hashtable elements
- into it, then returns both the array and the size of it. This is
- used by the memory-leak detector. The array must be freed with
- VG_(free). */
+/* Allocates a suitably-sized array, copies pointers to all the hashtable
+ elements into it, then returns both the array and the size of it. The
+ array must be freed with VG_(free). */
extern VgHashNode** VG_(HT_to_array) ( VgHashTable t, /*OUT*/ UInt* n_elems );
/* Reset the table's iterator to point to the first element. */
Modified: branches/DARWIN/include/pub_tool_oset.h
===================================================================
--- branches/DARWIN/include/pub_tool_oset.h 2009-05-06 06:27:19 UTC (rev 9782)
+++ branches/DARWIN/include/pub_tool_oset.h 2009-05-06 06:45:05 UTC (rev 9783)
@@ -72,9 +72,9 @@
typedef struct _OSet OSet;
-// - Cmp: returns -1, 0 or 1 if key is <, == or > elem.
+// - Cmp: returns -1, 0 or 1 if key is <, == or > elem.
// - Alloc: allocates a chunk of memory.
-// - Free: frees a chunk of memory allocated with Alloc.
+// - Free: frees a chunk of memory allocated with Alloc.
typedef Word (*OSetCmp_t) ( const void* key, const void* elem );
typedef void* (*OSetAlloc_t) ( HChar* ec, SizeT szB );
@@ -219,6 +219,11 @@
// * ResetIter: Each OSet has an iterator. This resets it to point to the
// first element in the OSet.
//
+// * ResetIterAt: Like ResetIter, but instead of resetting the iterator to the
+// smallest element, it resets the iterator to point to the smallest element
+// in the set whose key is greater-than-or-equal to the given key. (In many
+// cases this will be the element whose key equals that of the given key.)
+//
// * Next: Returns a pointer to the element pointed to by the OSet's
// iterator, and advances the iterator by one; the elements are visited
// in order. Or, returns NULL if the iterator has reached the OSet's end.
@@ -238,19 +243,15 @@
extern Word VG_(OSetGen_Size) ( const OSet* os );
extern void VG_(OSetGen_Insert) ( OSet* os, void* elem );
-extern Bool VG_(OSetGen_Contains) ( const OSet* os, const void* key );
-extern void* VG_(OSetGen_Lookup) ( const OSet* os, const void* key );
+extern Bool VG_(OSetGen_Contains) ( const OSet* os, const void* key );
+extern void* VG_(OSetGen_Lookup) ( const OSet* os, const void* key );
extern void* VG_(OSetGen_LookupWithCmp)( OSet* os,
const void* key, OSetCmp_t cmp );
-extern void* VG_(OSetGen_Remove) ( OSet* os, const void* key );
+extern void* VG_(OSetGen_Remove) ( OSet* os, const void* key );
extern void VG_(OSetGen_ResetIter) ( OSet* os );
+extern void VG_(OSetGen_ResetIterAt) ( OSet* os, const void* key );
extern void* VG_(OSetGen_Next) ( OSet* os );
-// set up 'oset' for iteration so that the first key subsequently
-// produced VG_(OSetGen_Next) is the smallest key in the map
-// >= start_at. Naturally ">=" is defined by the comparison
-// function supplied to VG_(OSetGen_Create).
-extern void VG_(OSetGen_ResetIterAt) ( OSet* oset, const void* key );
#endif // __PUB_TOOL_OSET_H
Modified: branches/DARWIN/massif/perf/Makefile.am
===================================================================
--- branches/DARWIN/massif/perf/Makefile.am 2009-05-06 06:27:19 UTC (rev 9782)
+++ branches/DARWIN/massif/perf/Makefile.am 2009-05-06 06:45:05 UTC (rev 9783)
@@ -1,6 +1,5 @@
-# For AM_FLAG_M3264_PRI
-include $(top_srcdir)/Makefile.flags.am
+include $(top_srcdir)/Makefile.tool-tests.am
EXTRA_DIST = \
many-xpts.vgperf
@@ -8,6 +7,6 @@
check_PROGRAMS = \
many-xpts
-AM_CFLAGS = -Winline -Wall -Wshadow -g -O $(AM_FLAG_M3264_PRI)
-AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/include -I$(top_builddir)/include
-AM_CXXFLAGS = $(AM_CFLAGS)
+AM_CFLAGS += -O $(AM_FLAG_M3264_PRI)
+AM_CXXFLAGS += -O $(AM_FLAG_M3264_PRI)
+
Modified: branches/DARWIN/memcheck/Makefile.am
===================================================================
--- branches/DARWIN/memcheck/Makefile.am 2009-05-06 06:27:19 UTC (rev 9782)
+++ branches/DARWIN/memcheck/Makefile.am 2009-05-06 06:45:05 UTC (rev 9783)
@@ -1,5 +1,7 @@
include $(top_srcdir)/Makefile.tool.am
+SUBDIRS += perf
+
noinst_PROGRAMS =
noinst_DSYMS =
if VGCONF_PLATFORMS_INCLUDE_X86_LINUX
Modified: branches/DARWIN/memcheck/mc_errors.c
===================================================================
--- branches/DARWIN/memcheck/mc_errors.c 2009-05-06 06:27:19 UTC (rev 9782)
+++ branches/DARWIN/memcheck/mc_errors.c 2009-05-06 06:45:05 UTC (rev 9783)
@@ -572,7 +572,7 @@
if (VG_(clo_xml)) {
VG_(message_no_f_c)(Vg_UserMsg, " <kind>%t</kind>",
- xml_leak_kind(lr->state));
+ xml_leak_kind(lr->key.state));
} else {
VG_(message)(Vg_UserMsg, "");
}
@@ -584,7 +584,7 @@
xpre,
lr->szB + lr->indirect_szB, lr->szB, lr->indirect_szB,
lr->num_blocks,
- str_leak_lossmode(lr->state), n_this_record, n_total_records,
+ str_leak_lossmode(lr->key.state), n_this_record, n_total_records,
xpost
);
if (VG_(clo_xml)) {
@@ -600,7 +600,7 @@
"%s%'lu bytes in %'u blocks are %s in loss record %'u of %'u%s",
xpre,
lr->szB, lr->num_blocks,
- str_leak_lossmode(lr->state), n_this_record, n_total_records,
+ str_leak_lossmode(lr->key.state), n_this_record, n_total_records,
xpost
);
if (VG_(clo_xml)) {
@@ -610,7 +610,7 @@
lr->num_blocks);
}
}
- VG_(pp_ExeContext)(lr->allocated_at);
+ VG_(pp_ExeContext)(lr->key.allocated_at);
break;
}
@@ -816,7 +816,7 @@
extra.Err.Leak.lr = lr;
return
VG_(unique_error) ( tid, Err_Leak, /*Addr*/0, /*s*/NULL, &extra,
- lr->allocated_at, print_record,
+ lr->key.allocated_at, print_record,
/*allow_GDB_attach*/False, /*count_error*/False );
}
Modified: branches/DARWIN/memcheck/mc_include.h
===================================================================
--- branches/DARWIN/memcheck/mc_include.h 2009-05-06 06:27:19 UTC (rev 9782)
+++ branches/DARWIN/memcheck/mc_include.h 2009-05-06 06:45:05 UTC (rev 9783)
@@ -230,13 +230,15 @@
typedef
enum {
- Unreached =0, // Not reached, ie. leaked.
- // (At best, only reachable from itself via a cycle.
- IndirectLeak =1, // Leaked, but reachable from another leaked block
+ // Nb: the order is important -- it dictates the order of loss records
+ // of equal sizes.
+ Reachable =0, // Definitely reachable from root-set.
+ Possible =1, // Possibly reachable from root-set; involves at
+ // least one interior-pointer along the way.
+ IndirectLeak =2, // Leaked, but reachable from another leaked block
// (be it Unreached or IndirectLeak).
- Possible =2, // Possibly reachable from root-set; involves at
- // least one interior-pointer along the way.
- Reachable =3 // Definitely reachable from root-set.
+ Unreached =3, // Not reached, ie. leaked.
+ // (At best, only reachable from itself via a cycle.)
}
Reachedness;
@@ -262,17 +264,23 @@
}
LeakCheckMode;
+/* When a LossRecord is put into an OSet, these elements represent the key. */
+typedef
+ struct _LossRecordKey {
+ Reachedness state; // LC_Extra.state value shared by all blocks.
+ ExeContext* allocated_at; // Where they were allocated.
+ }
+ LossRecordKey;
+
/* A loss record, used for generating err msgs. Multiple leaked blocks can be
* merged into a single loss record if they have the same state and similar
* enough allocation points (controlled by --leak-resolution). */
typedef
struct _LossRecord {
- struct _LossRecord* next;
- ExeContext* allocated_at; // Where they were allocated.
- Reachedness state; // LC_Extra.state value shared by all blocks.
- SizeT szB; // Sum of all MC_Chunk.szB values.
- SizeT indirect_szB; // Sum of all LC_Extra.indirect_szB values.
- UInt num_blocks; // Number of blocks represented by the record.
+ LossRecordKey key; // Key, when used in an OSet.
+ SizeT szB; // Sum of all MC_Chunk.szB values.
+ SizeT indirect_szB; // Sum of all LC_Extra.indirect_szB values.
+ UInt num_blocks; // Number of blocks represented by the record.
}
LossRecord;
Modified: branches/DARWIN/memcheck/mc_leakcheck.c
===================================================================
--- branches/DARWIN/memcheck/mc_leakcheck.c 2009-05-06 06:27:19 UTC (rev 9782)
+++ branches/DARWIN/memcheck/mc_leakcheck.c 2009-05-06 06:45:05 UTC (rev 9783)
@@ -40,6 +40,7 @@
#include "pub_tool_machine.h"
#include "pub_tool_mallocfree.h"
#include "pub_tool_options.h"
+#include "pub_tool_oset.h"
#include "pub_tool_signals.h"
#include "pub_tool_tooliface.h" // Needed for mc_include.h
@@ -751,77 +752,108 @@
}
}
+static Word cmp_LossRecordKey_LossRecord(const void* key, const void* elem)
+{
+ LossRecordKey* a = (LossRecordKey*)key;
+ LossRecordKey* b = &(((LossRecord*)elem)->key);
+
+ // Compare on states first because that's fast.
+ if (a->state < b->state) return -1;
+ if (a->state > b->state) return 1;
+ // Ok, the states are equal. Now compare the locations, which is slower.
+ if (VG_(eq_ExeContext)(
+ MC_(clo_leak_resolution), a->allocated_at, b->allocated_at))
+ return 0;
+ // Different locations. Ordering is arbitrary, just use the ec pointer.
+ if (a->allocated_at < b->allocated_at) return -1;
+ if (a->allocated_at > b->allocated_at) return 1;
+ VG_(tool_panic)("bad LossRecord comparison");
+}
+
+static Int cmp_LossRecords(void* va, void* vb)
+{
+ LossRecord* lr_a = *(LossRecord**)va;
+ LossRecord* lr_b = *(LossRecord**)vb;
+ SizeT total_szB_a = lr_a->szB + lr_a->indirect_szB;
+ SizeT total_szB_b = lr_b->szB + lr_b->indirect_szB;
+
+ // First compare by sizes.
+ if (total_szB_a < total_szB_b) return -1;
+ if (total_szB_a > total_szB_b) return 1;
+ // If size are equal, compare by states.
+ if (lr_a->key.state < lr_b->key.state) return -1;
+ if (lr_a->key.state > lr_b->key.state) return 1;
+ return 0;
+}
+
static void print_results(ThreadId tid, Bool is_full_check)
{
- Int i, n_lossrecords;
- LossRecord* lr_list;
- LossRecord* lr;
- Bool is_suppressed;
+ Int i, n_lossrecords;
+ OSet* lr_table;
+ LossRecord** lr_array;
+ LossRecord* lr;
+ Bool is_suppressed;
- // Common up the lost blocks so we can print sensible error messages.
- n_lossrecords = 0;
- lr_list = NULL;
+ // Create the lr_table, which holds the loss records.
+ lr_table =
+ VG_(OSetGen_Create)(offsetof(LossRecord, key),
+ cmp_LossRecordKey_LossRecord,
+ VG_(malloc), "mc.pr.1",
+ VG_(free));
+
+ // Convert the chunks into loss records, merging them where appropriate.
for (i = 0; i < lc_n_chunks; i++) {
- MC_Chunk* ch = lc_chunks[i];
- LC_Extra* ex = &(lc_extras)[i];
+ MC_Chunk* ch = lc_chunks[i];
+ LC_Extra* ex = &(lc_extras)[i];
+ LossRecord* old_lr;
+ LossRecordKey lrkey;
+ lrkey.state = ex->state;
+ lrkey.allocated_at = ch->where;
- // Determine if this chunk is sufficiently similar to any of our
- // previously-created loss records to merge.
- // XXX: This is quadratic! (see bug #191182)
- for (lr = lr_list; lr != NULL; lr = lr->next) {
- if (lr->state == ex->state
- && VG_(eq_ExeContext) ( MC_(clo_leak_resolution),
- lr->allocated_at,
- ch->where) ) {
- break;
- }
- }
- if (lr != NULL) {
- // Similar to a previous loss record; merge.
- lr->num_blocks++;
- lr->szB += ch->szB;
- lr->indirect_szB += ex->indirect_szB;
+ old_lr = VG_(OSetGen_Lookup)(lr_table, &lrkey);
+ if (old_lr) {
+ // We found an existing loss record matching this chunk. Update the
+ // loss record's details in-situ. This is safe because we don't
+ // change the elements used as the OSet key.
+ old_lr->szB += ch->szB;
+ old_lr->indirect_szB += ex->indirect_szB;
+ old_lr->num_blocks++;
} else {
- // Create a new loss record.
- n_lossrecords++;
- lr = VG_(malloc)( "mc.fr.1", sizeof(LossRecord));
- lr->state = ex->state;
- lr->allocated_at = ch->where;
- lr->szB = ch->szB;
- lr->indirect_szB = ex->indirect_szB;
- lr->num_blocks = 1;
- lr->next = lr_list;
- lr_list = lr;
+ // No existing loss record matches this chunk. Create a new loss
+ // record, initialise it from the chunk, and insert it into lr_table.
+ lr = VG_(OSetGen_AllocNode)(lr_table, sizeof(LossRecord));
+ lr->key = lrkey;
+ lr->szB = ch->szB;
+ lr->indirect_szB = ex->indirect_szB;
+ lr->num_blocks = 1;
+ VG_(OSetGen_Insert)(lr_table, lr);
}
}
+ n_lossrecords = VG_(OSetGen_Size)(lr_table);
+ // Create an array of pointers to the loss records.
+ lr_array = VG_(malloc)("mc.pr.2", n_lossrecords * sizeof(LossRecord*));
+ i = 0;
+ VG_(OSetGen_ResetIter)(lr_table);
+ while ( (lr = VG_(OSetGen_Next)(lr_table)) ) {
+ lr_array[i++] = lr;
+ }
+ tl_assert(i == n_lossrecords);
+
+ // Sort the array by loss record sizes.
+ VG_(ssort)(lr_array, n_lossrecords, sizeof(LossRecord*),
+ cmp_LossRecords);
+
+ // Zero totals.
MC_(blocks_leaked) = MC_(bytes_leaked) = 0;
MC_(blocks_indirect) = MC_(bytes_indirect) = 0;
MC_(blocks_dubious) = MC_(bytes_dubious) = 0;
MC_(blocks_reachable) = MC_(bytes_reachable) = 0;
MC_(blocks_suppressed) = MC_(bytes_suppressed) = 0;
- // Print out the loss records and collect summary stats.
+ // Print the loss records (in size order) and collect summary stats.
for (i = 0; i < n_lossrecords; i++) {
- Bool print_record;
- LossRecord* lr_min = NULL;
- SizeT total_szB_min = ~(0x0L);
- // Find the loss record covering the smallest number of directly-lost
- // bytes. Note that we set lr_min->num_blocks to zero after printing it;
- // that combined with the "lr->num_blocks > 0" test ensures that each
- // loss record is only printed once.
- // XXX: This is quadratic! (see bug #191182)
- // XXX: why do we show the smallest loss records first -- biggest first
- // would make more sense?
- for (lr = lr_list; lr != NULL; lr = lr->next) {
- SizeT total_szB = lr->szB + lr->indirect_szB;
- if (lr->num_blocks > 0 && total_szB < total_szB_min) {
- total_szB_min = total_szB;
- lr_min = lr;
- }
- }
- tl_assert(lr_min != NULL);
-
+ Bool print_record;
// Rules for printing:
// - We don't show suppressed loss records ever (and that's controlled
// within the error manager).
@@ -834,38 +866,37 @@
// this is different to "still reachable" used elsewhere because it
// includes indirectly lost blocks!
//
+ lr = lr_array[i];
print_record = is_full_check &&
( MC_(clo_show_reachable) ||
- Unreached == lr_min->state ||
- Possible == lr_min->state );
+ Unreached == lr->key.state ||
+ Possible == lr->key.state );
is_suppressed =
- MC_(record_leak_error) ( tid, i+1, n_lossrecords, lr_min,
- print_record );
+ MC_(record_leak_error) ( tid, i+1, n_lossrecords, lr, print_record );
if (is_suppressed) {
- MC_(blocks_suppressed) += lr_min->num_blocks;
- MC_(bytes_suppressed) += lr_min->szB;
+ MC_(blocks_suppressed) += lr->num_blocks;
+ MC_(bytes_suppressed) += lr->szB;
- } else if (Unreached == lr_min->state) {
- MC_(blocks_leaked) += lr_min->num_blocks;
- MC_(bytes_leaked) += lr_min->szB;
+ } else if (Unreached == lr->key.state) {
+ MC_(blocks_leaked) += lr->num_blocks;
+ MC_(bytes_leaked) += lr->szB;
- } else if (IndirectLeak == lr_min->state) {
- MC_(blocks_indirect) += lr_min->num_blocks;
- MC_(bytes_indirect) += lr_min->szB;
+ } else if (IndirectLeak == lr->key.state) {
+ MC_(blocks_indirect) += lr->num_blocks;
+ MC_(bytes_indirect) += lr->szB;
- } else if (Possible == lr_min->state) {
- MC_(blocks_dubious) += lr_min->num_blocks;
- MC_(bytes_dubious) += lr_min->szB;
+ } else if (Possible == lr->key.state) {
+ MC_(blocks_dubious) += lr->num_blocks;
+ MC_(bytes_dubious) += lr->szB;
- } else if (Reachable == lr_min->state) {
- MC_(blocks_reachable) += lr_min->num_blocks;
- MC_(bytes_reachable) += lr_min->szB;
+ } else if (Reachable == lr->key.state) {
+ MC_(blocks_reachable) += lr->num_blocks;
+ MC_(bytes_reachable) += lr->szB;
} else {
VG_(tool_panic)("unknown loss mode");
}
- lr_min->num_blocks = 0;
}
if (VG_(clo_verbosity) > 0 && !VG_(clo_xml)) {
Copied: branches/DARWIN/memcheck/perf (from rev 9781, trunk/memcheck/perf)
Modified: branches/DARWIN/memcheck/perf/many-loss-records.c
===================================================================
--- trunk/memcheck/perf/many-loss-records.c 2009-05-06 06:15:55 UTC (rev 9781)
+++ branches/DARWIN/memcheck/perf/many-loss-records.c 2009-05-06 06:45:05 UTC (rev 9783)
@@ -8,7 +8,7 @@
// fixed it took about 2 seconds, and the leak checking was only a small
// fraction of that. --njn
-#include <malloc.h>
+#include <stdlib.h>
#include <strings.h>
#include <stdio.h>
#include <math.h>
Modified: branches/DARWIN/memcheck/tests/Makefile.am
===================================================================
--- branches/DARWIN/memcheck/tests/Makefile.am 2009-05-06 06:27:19 UTC (rev 9782)
+++ branches/DARWIN/memcheck/tests/Makefile.am 2009-05-06 06:45:05 UTC (rev 9783)
@@ -95,7 +95,7 @@
memalign2.stderr.exp memalign2.vgtest \
memcmptest.stderr.exp memcmptest.stderr.exp2 \
memcmptest.stdout.exp memcmptest.vgtest \
- mempool.stderr.exp mempool.stderr.exp64 mempool.vgtest \
+ mempool.stderr.exp mempool.vgtest \
metadata.stderr.exp metadata.stdout.exp metadata.vgtest \
mismatches.stderr.exp mismatches.vgtest \
mmaptest.stderr.exp mmaptest.vgtest \
Modified: branches/DARWIN/memcheck/tests/leak-cases-full.stderr.exp
===================================================================
--- branches/DARWIN/memcheck/tests/leak-cases-full.stderr.exp 2009-05-06 06:27:19 UTC (rev 9782)
+++ branches/DARWIN/memcheck/tests/leak-cases-full.stderr.exp 2009-05-06 06:45:05 UTC (rev 9783)
@@ -20,28 +20,28 @@
16 bytes in 1 blocks are possibly lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-cases.c:52)
- by 0x........: f (leak-cases.c:84)
+ by 0x........: f (leak-cases.c:78)
by 0x........: main (leak-cases.c:107)
16 bytes in 1 blocks are possibly lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-cases.c:52)
- by 0x........: f (leak-cases.c:84)
+ by 0x........: f (leak-cases.c:81)
by 0x........: main (leak-cases.c:107)
16 bytes in 1 blocks are possibly lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-cases.c:52)
- by 0x........: f (leak-cases.c:81)
+ by 0x........: f (leak-cases.c:84)
by 0x........: main (leak-cases.c:107)
16 bytes in 1 blocks are possibly lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-cases.c:52)
- by 0x........: f (leak-cases.c:78)
+ by 0x........: f (leak-cases.c:84)
by 0x........: main (leak-cases.c:107)
@@ -55,12 +55,12 @@
32 (16 direct, 16 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-cases.c:52)
- by 0x........: f (leak-cases.c:91)
+ by 0x........: f (leak-cases.c:76)
by 0x........: main (leak-cases.c:107)
32 (16 direct, 16 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-cases.c:52)
- by 0x........: f (leak-cases.c:76)
+ by 0x........: f (leak-cases.c:91)
by 0x........: main (leak-cases.c:107)
Modified: branches/DARWIN/memcheck/tests/leak-cycle.stderr.exp
===================================================================
--- branches/DARWIN/memcheck/tests/leak-cycle.stderr.exp 2009-05-06 06:27:19 UTC (rev 9782)
+++ branches/DARWIN/memcheck/tests/leak-cycle.stderr.exp 2009-05-06 06:45:05 UTC (rev 9783)
@@ -7,25 +7,25 @@
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-cycle.c:15)
by 0x........: mkcycle (leak-cycle.c:26)
- by 0x........: main (leak-cycle.c:45)
+ by 0x........: main (leak-cycle.c:44)
48 (16 direct, 32 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-cycle.c:15)
by 0x........: mkcycle (leak-cycle.c:26)
- by 0x........: main (leak-cycle.c:44)
+ by 0x........: main (leak-cycle.c:45)
96 (16 direct, 80 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-cycle.c:15)
by 0x........: mkcycle (leak-cycle.c:26)
- by 0x........: main (leak-cycle.c:63)
+ by 0x........: main (leak-cycle.c:51)
96 (16 direct, 80 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-cycle.c:15)
by 0x........: mkcycle (leak-cycle.c:26)
- by 0x........: main (leak-cycle.c:51)
+ by 0x........: main (leak-cycle.c:63)
Modified: branches/DARWIN/memcheck/tests/mempool.c
===================================================================
--- branches/DARWIN/memcheck/tests/mempool.c 2009-05-06 06:27:19 UTC (rev 9782)
+++ branches/DARWIN/memcheck/tests/mempool.c 2009-05-06 06:45:05 UTC (rev 9783)
@@ -14,13 +14,19 @@
{
struct _level_list *next;
char *where;
+ // Padding ensures the struct is the same size on 32-bit and 64-bit
+ // machines.
+ char padding[16 - 2*sizeof(char*)];
} level_list;
typedef struct _pool {
char *mem;
char *where;
+ level_list *levels;
int size, left;
- level_list *levels;
+ // Padding ensures the struct is the same size on 32-bit and 64-bit
+ // machines.
+ char padding[24 - 3*sizeof(char*)];
} pool;
pool *make_pool()
Modified: branches/DARWIN/memcheck/tests/mempool.stderr.exp
===================================================================
--- branches/DARWIN/memcheck/tests/mempool.stderr.exp 2009-05-06 06:27:19 UTC (rev 9782)
+++ branches/DARWIN/memcheck/tests/mempool.stderr.exp 2009-05-06 06:45:05 UTC (rev 9783)
@@ -1,60 +1,60 @@
Invalid write of size 1
- at 0x........: test (mempool.c:124)
- by 0x........: main (mempool.c:148)
+ at 0x........: test (mempool.c:130)
+ by 0x........: main (mempool.c:154)
Address 0x........ is 7 bytes inside a block of size 100,000 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: make_pool (mempool.c:38)
- by 0x........: test (mempool.c:111)
- by 0x........: main (mempool.c:148)
+ by 0x........: make_pool (mempool.c:44)
+ by 0x........: test (mempool.c:117)
+ by 0x........: main (mempool.c:154)
Invalid write of size 1
- at 0x........: test (mempool.c:125)
- by 0x........: main (mempool.c:148)
+ at 0x........: test (mempool.c:131)
+ by 0x........: main (mempool.c:154)
Address 0x........ is 18 bytes inside a block of size 100,000 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: make_pool (mempool.c:38)
- by 0x........: test (mempool.c:111)
- by 0x........: main (mempool.c:148)
+ by 0x........: make_pool (mempool.c:44)
+ by 0x........: test (mempool.c:117)
+ by 0x........: main (mempool.c:154)
Invalid write of size 1
- at 0x........: test (mempool.c:129)
- by 0x........: main (mempool.c:148)
+ at 0x........: test (mempool.c:135)
+ by 0x........: main (mempool.c:154)
Address 0x........ is 70 bytes inside a block of size 100,000 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: make_pool (mempool.c:38)
- by 0x........: test (mempool.c:111)
- by 0x........: main (mempool.c:148)
+ by 0x........: make_pool (mempool.c:44)
+ by 0x........: test (mempool.c:117)
+ by 0x........: main (mempool.c:154)
Invalid write of size 1
- at 0x........: test (mempool.c:130)
- by 0x........: main (mempool.c:148)
+ at 0x........: test (mempool.c:136)
+ by 0x........: main (mempool.c:154)
Address 0x........ is 96 bytes inside a block of size 100,000 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: make_pool (mempool.c:38)
- by 0x........: test (mempool.c:111)
- by 0x........: main (mempool.c:148)
+ by 0x........: make_pool (mempool.c:44)
+ by 0x........: test (mempool.c:117)
+ by 0x........: main (mempool.c:154)
10 bytes in 1 blocks are definitely lost in loss record ... of ...
- at 0x........: allocate (mempool.c:99)
- by 0x........: test (mempool.c:135)
- by 0x........: main (mempool.c:148)
+ at 0x........: allocate (mempool.c:105)
+ by 0x........: test (mempool.c:121)
+ by 0x........: main (mempool.c:154)
10 bytes in 1 blocks are definitely lost in loss record ... of ...
- at 0x........: allocate (mempool.c:99)
- by 0x........: test (mempool.c:115)
- by 0x........: main (mempool.c:148)
+ at 0x........: allocate (mempool.c:105)
+ by 0x........: test (mempool.c:141)
+ by 0x........: main (mempool.c:154)
20 bytes in 1 blocks are definitely lost in loss record ... of ...
- at 0x........: allocate (mempool.c:99)
- by 0x........: test (mempool.c:116)
- by 0x........: main (mempool.c:148)
+ at 0x........: allocate (mempool.c:105)
+ by 0x........: test (mempool.c:122)
+ by 0x........: main (mempool.c:154)
-28 (20 direct, 8 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
+48 (32 direct, 16 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: make_pool (mempool.c:37)
- by 0x........: test (mempool.c:111)
- by 0x........: main (mempool.c:148)
+ by 0x........: make_pool (mempool.c:43)
+ by 0x........: test (mempool.c:117)
+ by 0x........: main (mempool.c:154)
Deleted: branches/DARWIN/memcheck/tests/mempool.stderr.exp64
===================================================================
--- branches/DARWIN/memcheck/tests/mempool.stderr.exp64 2009-05-06 06:27:19 UTC (rev 9782)
+++ branches/DARWIN/memcheck/tests/mempool.stderr.exp64 2009-05-06 06:45:05 UTC (rev 9783)
@@ -1,60 +0,0 @@
-Invalid write of size 1
- at 0x........: test (mempool.c:124)
- by 0x........: main (mempool.c:148)
- Address 0x........ is 7 bytes inside a block of size 100,000 alloc'd
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: make_pool (mempool.c:38)
- by 0x........: test (mempool.c:111)
- by 0x........: main (mempool.c:148)
-
-Invalid write of size 1
- at 0x........: test (mempool.c:125)
- by 0x........: main (mempool.c:148)
- Address 0x........ is 18 bytes inside a block of size 100,000 alloc'd
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: make_pool (mempool.c:38)
- by 0x........: test (mempool.c:111)
- by 0x........: main (mempool.c:148)
-
-Invalid write of size 1
- at 0x........: test (mempool.c:129)
- by 0x........: main (mempool.c:148)
- Address 0x........ is 70 bytes inside a block of size 100,000 alloc'd
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: make_pool (mempool.c:38)
- by 0x........: test (mempool.c:111)
- by 0x........: main (mempool.c:148)
-
-Invalid write of size 1
- at 0x........: test (mempool.c:130)
- by 0x........: main (mempool.c:148)
- Address 0x........ is 96 bytes inside a block of size 100,000 alloc'd
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: make_pool (mempool.c:38)
- by 0x........: test (mempool.c:111)
- by 0x........: main (mempool.c:148)
-
-
-10 bytes in 1 blocks are definitely lost in loss record ... of ...
- at 0x........: allocate (mempool.c:99)
- by 0x........: test (mempool.c:135)
- by 0x........: main (mempool.c:148)
-
-
-10 bytes in 1 blocks are definitely lost in loss record ... of ...
- at 0x........: allocate (mempool.c:99)
- by 0x........: test (mempool.c:115)
- by 0x........: main (mempool.c:148)
-
-
-20 bytes in 1 blocks are definitely lost in loss record ... of ...
- at 0x........: allocate (mempool.c:99)
- by 0x........: test (mempool.c:116)
- by 0x........: main (mempool.c:148)
-
-
-48 (32 direct, 16 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
- at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: make_pool (mempool.c:37)
- by 0x........: test (mempool.c:111)
- by 0x........: main (mempool.c:148)
|