mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-29 15:16:05 +00:00
Fixed: Memory leaks in CBigFile
--HG-- branch : develop
This commit is contained in:
parent
8cc3963ddd
commit
91d6734e2a
2 changed files with 26 additions and 3 deletions
|
@ -112,7 +112,8 @@ public:
|
||||||
// A BNP structure
|
// A BNP structure
|
||||||
struct BNP
|
struct BNP
|
||||||
{
|
{
|
||||||
BNP() : FileNames(NULL), ThreadFileId(0), CacheFileOnOpen(false), AlwaysOpened(false), InternalUse(false), OffsetFromBeginning(0) { }
|
BNP();
|
||||||
|
~BNP();
|
||||||
|
|
||||||
// FileName of the BNP. important to open it in getFile() (for other threads or if not always opened).
|
// FileName of the BNP. important to open it in getFile() (for other threads or if not always opened).
|
||||||
std::string BigFileName;
|
std::string BigFileName;
|
||||||
|
@ -163,6 +164,7 @@ private:
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CThreadFileArray();
|
CThreadFileArray();
|
||||||
|
~CThreadFileArray();
|
||||||
|
|
||||||
// Allocate a FileId for a BNP.
|
// Allocate a FileId for a BNP.
|
||||||
uint32 allocate();
|
uint32 allocate();
|
||||||
|
|
|
@ -45,8 +45,16 @@ void CBigFile::releaseInstance()
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
CBigFile::CThreadFileArray::CThreadFileArray()
|
CBigFile::CThreadFileArray::CThreadFileArray()
|
||||||
{
|
{
|
||||||
_CurrentId= 0;
|
_CurrentId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ***************************************************************************
|
||||||
|
CBigFile::CThreadFileArray::~CThreadFileArray()
|
||||||
|
{
|
||||||
|
vector<CHandleFile> *ptr = (vector<CHandleFile>*)_TDS.getPointer();
|
||||||
|
if (ptr) delete ptr;
|
||||||
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
uint32 CBigFile::CThreadFileArray::allocate()
|
uint32 CBigFile::CThreadFileArray::allocate()
|
||||||
{
|
{
|
||||||
|
@ -186,11 +194,24 @@ void CBigFile::remove (const std::string &sBigFileName)
|
||||||
fclose (handle.File);
|
fclose (handle.File);
|
||||||
handle.File= NULL;
|
handle.File= NULL;
|
||||||
}
|
}
|
||||||
delete [] rbnp.FileNames;
|
|
||||||
_BNPs.erase (it);
|
_BNPs.erase (it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CBigFile::BNP::BNP() : FileNames(NULL), ThreadFileId(0), CacheFileOnOpen(false), AlwaysOpened(false), InternalUse(false), OffsetFromBeginning(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CBigFile::BNP::~BNP()
|
||||||
|
{
|
||||||
|
if (FileNames)
|
||||||
|
{
|
||||||
|
delete[] FileNames;
|
||||||
|
FileNames = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//// ***************************************************************************
|
//// ***************************************************************************
|
||||||
bool CBigFile::BNP::readHeader()
|
bool CBigFile::BNP::readHeader()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue