Skip to content

Commit

Permalink
Delete buffers when the buffer manager is deleted. Fixes #414
Browse files Browse the repository at this point in the history
  • Loading branch information
abh3 committed Jan 20, 2017
1 parent af1b984 commit 98628b1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
18 changes: 17 additions & 1 deletion src/Xrd/XrdBuffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#include "XrdSys/XrdSysPlatform.hh"
#include "XrdSys/XrdSysTimer.hh"
#include "Xrd/XrdBuffer.hh"
//??#include "Xrd/XrdBuffXL.hh"
#include "XrdBuffXL.hh"

#define XRD_TRACE XrdTrace->
Expand Down Expand Up @@ -107,6 +106,23 @@ XrdBuffManager::XrdBuffManager(XrdSysError *lP, XrdOucTrace *tP, int minrst) :
memset(static_cast<void *>(bucket), 0, sizeof(bucket));
}

/******************************************************************************/
/* D e s t r u c t o r */
/******************************************************************************/

XrdBuffManager::~XrdBuffManager()
{
XrdBuffer *bP;

for (int i = 0; i < XRD_BUCKETS; i++)
{while((bP = bucket[i].bnext))
{bucket[i].bnext = bP->next;
delete bP;
}
bucket[i].numbuf = 0;
}
}

/******************************************************************************/
/* I n i t */
/******************************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion src/Xrd/XrdBuffer.hh
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ int Stats(char *buff, int blen, int do_sync=0);

XrdBuffManager(XrdSysError *lP, XrdOucTrace *tP, int minrst=20*60);

~XrdBuffManager() {} // The buffmanager is never deleted
~XrdBuffManager(); // The buffmanager is never deleted

private:

Expand Down

0 comments on commit 98628b1

Please sign in to comment.