Essentially leak free (mem and disk) after a few hours of roseTable

This commit is contained in:
Sears Russell 2007-11-12 07:27:49 +00:00
parent ecc2392066
commit 799c7498cd
7 changed files with 20 additions and 8 deletions

View file

@ -454,9 +454,7 @@ class versioningIterator {
it_ = i.it_;
itend_ = i.itend_;
}
// inline unsigned int offset() { return off_; }
private:
// unsigned int off_;
STLITER it_;
STLITER itend_;
friend const byte*

View file

@ -62,6 +62,7 @@ namespace rose {
}
pageCount++;
stasis_page_cleanup(p);
typename PAGELAYOUT::FMT * mc = PAGELAYOUT::initPage(p, &**begin);
for(ITER i(*begin); i != *end; ++i) {
@ -198,7 +199,7 @@ namespace rose {
pageid_t mergedPages = compressData
<PAGELAYOUT,versioningIterator<mergeIterator<ITERA,ITERB,typename PAGELAYOUT::FMT::TUP>, typename PAGELAYOUT::FMT::TUP> >
(xid, &vBegin, &vEnd,tree->r_,a->pageAlloc,a->pageAllocState,&insertedTuples);
(xid, &vBegin, &vEnd,tree->r_,a->pageAlloc,a->pageAllocState,&insertedTuples);
/* pageid_t mergedPages = compressData
<PAGELAYOUT,mergeIterator<ITERA,ITERB,typename PAGELAYOUT::FMT::TUP> >
(xid, &mBegin, &mEnd,tree->r_,a->pageAlloc,a->pageAllocState,&insertedTuples); */
@ -236,8 +237,17 @@ namespace rose {
// TlsmFree(xid, ((typename ITERB::handle)old_in_tree)->r_,TlsmRegionDeallocRid,a->in_tree_allocer);
// XXX kludge; assumes C1 and C2 have same type of handle....
TlsmFree(xid, ((typename ITERA::handle)old_in_tree)->r_,TlsmRegionDeallocRid,a->in_tree_allocer);
delete old_in_tree;
} else {
((typename stlSetIterator<std::set<typename PAGELAYOUT::FMT::TUP,
typename PAGELAYOUT::FMT::TUP::stl_cmp>,
typename PAGELAYOUT::FMT::TUP>::handle)old_in_tree)->clear();
delete
((typename stlSetIterator<std::set<typename PAGELAYOUT::FMT::TUP,
typename PAGELAYOUT::FMT::TUP::stl_cmp>,
typename PAGELAYOUT::FMT::TUP>::handle)old_in_tree);
}
delete old_in_tree;
free(*a->in_tree); // free pointer to handle
// XXX should we delay this to this point?
@ -526,6 +536,7 @@ namespace rose {
template<class PAGELAYOUT>
void TlsmTableStop( lsmTableHandle<PAGELAYOUT> * h) {
TlsmTableFlush(h);
delete(h->scratch_handle);
*(h->still_open) = 0;
pthread_join(h->merge1_thread,0);
pthread_join(h->merge2_thread,0);

View file

@ -97,7 +97,7 @@ class StaticMulticolumn {
exceptions_(new byte[USABLE_SIZE_OF_PAGE]),
unpacked_(1)
{
stasis_page_cleanup(p);
*column_count_ptr() = N;
bytes_left_ = first_header_byte_ptr()- p->memAddr;
@ -106,7 +106,7 @@ class StaticMulticolumn {
if(i < N) { \
columns_[i] = new byte[USABLE_SIZE_OF_PAGE]; \
cmp = new typ(xid,(void*)columns_[i]); \
cmp->init_mem(columns_[i]); \
cmp->init_mem(columns_[i]); \
*column_plugin_id_ptr(i) = cmp->PLUGIN_ID; \
bytes_left_ -= cmp->bytes_used(); \
}
@ -127,7 +127,7 @@ class StaticMulticolumn {
#define STATIC_MC_DEINIT(i,plug) \
if(i < N) { \
if(unpacked_) delete [] columns_[i]; \
delete plug; \
delete plug; \
}
STATIC_MC_DEINIT(0,plugin0);
@ -501,7 +501,6 @@ template <int N, class TUPLE,
class COMP0, class COMP1, class COMP2, class COMP3, class COMP4,
class COMP5, class COMP6, class COMP7, class COMP8, class COMP9>
static void staticMulticolumnCleanup(Page *p) {
// printf("cleanup %d\n", N); fflush(stdout);
delete (StaticMulticolumn<N,TUPLE,COMP0,COMP1,COMP2,COMP3,COMP4,COMP5,COMP6,COMP7,COMP8,COMP9>*)p->impl;
p->impl = 0;
}

View file

@ -14,6 +14,7 @@ void stasis_fixed_initialize_page(Page * page, size_t size, int count) {
assertlocked(page->rwlatch);
// XXX fixed page asserts it's been given an UNINITIALIZED_PAGE... Why doesn't that crash?
// assert(*stasis_page_type_ptr(page) == UNINITIALIZED_PAGE);
stasis_page_cleanup(page);
*stasis_page_type_ptr(page) = FIXED_PAGE;
*recordsize_ptr(page) = size;
assert(count <= stasis_fixed_records_per_page(size));

View file

@ -15,6 +15,7 @@ int headerPageInitialize() {
if(*page_type_ptr(p) != LLADD_HEADER_PAGE) {
assert(*page_type_ptr(p) == 0) ;
memset(p->memAddr, 0, PAGE_SIZE);
stasis_page_cleanup(p);
*page_type_ptr(p) = LLADD_HEADER_PAGE;
*headerFreepage_ptr(p) = 1;
*headerFreepagelist_ptr(p) = 0;

View file

@ -10,6 +10,7 @@
void indirectInitialize(Page * p, int height) {
*level_ptr(p) = height;
stasis_page_cleanup(p);
*stasis_page_type_ptr(p) = INDIRECT_PAGE;
memset(p->memAddr, INVALID_SLOT, ((size_t)level_ptr(p)) - ((size_t)p->memAddr));
}

View file

@ -195,6 +195,7 @@ void slottedPageDeinit() {
void stasis_slotted_initialize_page(Page * page) {
assertlocked(page->rwlatch);
stasis_page_cleanup(page);
*stasis_page_type_ptr(page) = SLOTTED_PAGE;
*freespace_ptr(page) = 0;
*numslots_ptr(page) = 0;