Questionable attempts to appease valgrind.

This commit is contained in:
Sears Russell 2008-03-14 03:09:29 +00:00
parent 3b70dfaab7
commit b1bfe7979f
4 changed files with 24 additions and 15 deletions

View file

@ -4,7 +4,7 @@
# Dashboard is opened for submissions for a 24 hour period starting at # Dashboard is opened for submissions for a 24 hour period starting at
# the specified NIGHLY_START_TIME. Time is specified in 24 hour format. # the specified NIGHLY_START_TIME. Time is specified in 24 hour format.
SET (CTEST_NIGHTLY_START_TIME "23:00:00 EDT") SET (CTEST_NIGHTLY_START_TIME "23:00:00 EDT")
SET (CTEST_TIME_OUT 3000)
# Dart server to submit results (used by client) # Dart server to submit results (used by client)
IF(CTEST_DROP_METHOD MATCHES http) IF(CTEST_DROP_METHOD MATCHES http)
# SET (CTEST_DROP_SITE "public.kitware.com") # SET (CTEST_DROP_SITE "public.kitware.com")

View file

@ -101,7 +101,7 @@ inline static void remove_xidAlloced(allocationPolicy * ap, int xid, availablePa
struct RB_ENTRY(tree) * pages = LH_ENTRY(find)(ap->xidAlloced, &xid, sizeof(xid)); struct RB_ENTRY(tree) * pages = LH_ENTRY(find)(ap->xidAlloced, &xid, sizeof(xid));
assert(pages); assert(pages);
const availablePage * check = RB_ENTRY(delete)(p, pages); const availablePage * check = RB_ENTRY(delete)(p, pages);
assert(check == p); assert(check == p); // sometimes fails
} }
inline static void insert_xidDealloced(allocationPolicy * ap, int xid, availablePage * p) { inline static void insert_xidDealloced(allocationPolicy * ap, int xid, availablePage * p) {
@ -319,6 +319,8 @@ void allocationPolicyAllocedFromPage(allocationPolicy *ap, int xid, int pageid)
if(check1) { if(check1) {
assert(p->lockCount == 0); assert(p->lockCount == 0);
lockAlloced(ap, xid, (availablePage*)p); lockAlloced(ap, xid, (availablePage*)p);
} else {
assert(*xidp == xid); // new
} }
} }
@ -375,7 +377,7 @@ void allocationPolicyUpdateFreespaceLockedPage(allocationPolicy * ap, int xid, a
struct RB_ENTRY(tree) * locks = LH_ENTRY(find)(ap->xidAlloced, &xid, sizeof(int)); struct RB_ENTRY(tree) * locks = LH_ENTRY(find)(ap->xidAlloced, &xid, sizeof(int));
assert(key); assert(key);
availablePage * p = (availablePage*) RB_ENTRY(delete)(key, locks); availablePage * p = (availablePage*) RB_ENTRY(delete)(key, locks);
assert(p); assert(p); // sometimes fails
p->freespace = newFree; p->freespace = newFree;
key->freespace = newFree; key->freespace = newFree;
const availablePage * ret = RB_ENTRY(search)(p, locks); const availablePage * ret = RB_ENTRY(search)(p, locks);

View file

@ -48,9 +48,9 @@ terms specified in this license.
#include "../page.h" // For stasis_record_type_to_size() #include "../page.h" // For stasis_record_type_to_size()
#include <stasis/logger/logger2.h> // needed for LoggerSizeOfInternalLogEntry() #include <stasis/logger/logger2.h> // needed for LoggerSizeOfInternalLogEntry()
#include <stasis/logger/logEntry.h> #include <stasis/logger/logEntry.h>
#include <stasis/crc32.h>
LogEntry * allocCommonLogEntry(lsn_t prevLSN, int xid, unsigned int type) { LogEntry * allocCommonLogEntry(lsn_t prevLSN, int xid, unsigned int type) {
LogEntry * ret = malloc(sizeof(struct __raw_log_entry)); LogEntry * ret = calloc(1,sizeof(struct __raw_log_entry));
ret->LSN = -1; ret->LSN = -1;
ret->prevLSN = prevLSN; ret->prevLSN = prevLSN;
ret->xid = xid; ret->xid = xid;
@ -96,12 +96,14 @@ LogEntry * allocUpdateLogEntry(lsn_t prevLSN, int xid,
/** Use calloc since the struct might not be packed in memory; /** Use calloc since the struct might not be packed in memory;
otherwise, we'd leak uninitialized bytes to the log. */ otherwise, we'd leak uninitialized bytes to the log. */
LogEntry * ret = calloc(1, sizeof(struct __raw_log_entry) + size_t logentrysize =
sizeof(UpdateLogEntry) + argSize + sizeof(struct __raw_log_entry) +
((!invertible) ? stasis_record_type_to_size(rid.size) sizeof(UpdateLogEntry) + argSize +
: 0) + ((!invertible) ? stasis_record_type_to_size(rid.size)
(whole_page_phys ? PAGE_SIZE : 0) +
: 0)); (whole_page_phys ? PAGE_SIZE
: 0);
LogEntry * ret = calloc(1,logentrysize);
ret->LSN = -1; ret->LSN = -1;
ret->prevLSN = prevLSN; ret->prevLSN = prevLSN;
ret->xid = xid; ret->xid = xid;
@ -121,6 +123,9 @@ LogEntry * allocUpdateLogEntry(lsn_t prevLSN, int xid,
memcpy((void*)getUpdatePreImage(ret), preImage, memcpy((void*)getUpdatePreImage(ret), preImage,
PAGE_SIZE); PAGE_SIZE);
} }
//assert(logentrysize == sizeofLogEntry(ret));
// XXX checks for uninitialized values in valgrind
// stasis_crc32(ret, sizeofLogEntry(ret), 0);
return ret; return ret;
} }
@ -138,7 +143,7 @@ LogEntry * allocCLRLogEntry(const LogEntry * old_e) {
// Could handle other types, but we should never encounter them here. // Could handle other types, but we should never encounter them here.
assert(old_e->type == UPDATELOG); assert(old_e->type == UPDATELOG);
LogEntry * ret = malloc(sizeofLogEntry(old_e)); LogEntry * ret = calloc(1, sizeofLogEntry(old_e));
memcpy(ret, old_e, sizeofLogEntry(old_e)); memcpy(ret, old_e, sizeofLogEntry(old_e));
ret->LSN = -1; ret->LSN = -1;
// prevLSN is OK already // prevLSN is OK already

View file

@ -514,6 +514,8 @@ BEGIN_C_DECLS
* @todo recordid.page should be 64bit. * @todo recordid.page should be 64bit.
* @todo int64_t (for recordid.size) is a stopgap fix. * @todo int64_t (for recordid.size) is a stopgap fix.
*/ */
#pragma pack(push)
#pragma pack(1)
typedef struct { typedef struct {
int page; // XXX needs to be pageid_t, but that breaks unit tests. int page; // XXX needs to be pageid_t, but that breaks unit tests.
int slot; int slot;
@ -525,7 +527,7 @@ typedef struct {
size_t size; size_t size;
// unsigned fd : 1; // unsigned fd : 1;
} blob_record_t; } blob_record_t;
#pragma pack(pop)
extern const recordid ROOT_RECORD; extern const recordid ROOT_RECORD;