Commit a9ab9d05 authored by joreland@mysql.com's avatar joreland@mysql.com

Default = memset(0)

parent 87b22e8a
......@@ -94,7 +94,8 @@ void Dbacc::initRecords()
page8 = (Page8*)allocRecord("Page8",
sizeof(Page8),
cpagesize);
cpagesize,
false);
rootfragmentrec = (Rootfragmentrec*)allocRecord("Rootfragmentrec",
sizeof(Rootfragmentrec),
......@@ -114,7 +115,8 @@ void Dbacc::initRecords()
undopage = (Undopage*)allocRecord("Undopage",
sizeof(Undopage),
cundopagesize);
cundopagesize,
false);
// Initialize BAT for interface to file system
......
......@@ -121,7 +121,8 @@ void Dblqh::initRecords()
logPageRecord = (LogPageRecord*)allocRecord("LogPageRecord",
sizeof(LogPageRecord),
clogPageFileSize);
clogPageFileSize,
false);
pageRefRecord = (PageRefRecord*)allocRecord("PageRefRecord",
sizeof(PageRefRecord),
......
......@@ -698,7 +698,8 @@ void Dbtup::initRecords()
page = (Page*)allocRecord("Page",
sizeof(Page),
cnoOfPage);
cnoOfPage,
false);
pageRange = (PageRange*)allocRecord("PageRange",
sizeof(PageRange),
......
......@@ -636,7 +636,7 @@ SimulatedBlock::getBatSize(Uint16 blockNo){
}
void*
SimulatedBlock::allocRecord(const char * type, size_t s, size_t n)
SimulatedBlock::allocRecord(const char * type, size_t s, size_t n, bool clear)
{
void* p = NULL;
......@@ -657,16 +657,20 @@ SimulatedBlock::allocRecord(const char * type, size_t s, size_t n)
char buf2[255];
snprintf(buf1, sizeof(buf1), "%s could not allocate memory for %s",
getBlockName(number()), type);
snprintf(buf2, sizeof(buf2), "Requested: %ux%u = %u bytes", (Uint32)s, (Uint32)n, (Uint32)size);
snprintf(buf2, sizeof(buf2), "Requested: %ux%u = %u bytes",
(Uint32)s, (Uint32)n, (Uint32)size);
ERROR_SET(fatal, ERR_MEMALLOC, buf1, buf2);
}
if(clear)
memset(p, 0, size);
}
return p;
}
void
SimulatedBlock::deallocRecord(void ** ptr,
const char * type, size_t s, size_t n) const {
const char * type, size_t s, size_t n){
(void)type;
(void)s;
(void)n;
......
......@@ -350,14 +350,14 @@ protected:
* Allocates memory for the datastructures where ndb keeps the data
*
*/
void* allocRecord(const char * type, size_t s, size_t n);
void* allocRecord(const char * type, size_t s, size_t n, bool clear = true);
/**
* Deallocate record
*
* NOTE: Also resets pointer
*/
void deallocRecord(void **, const char * type, size_t s, size_t n) const ;
void deallocRecord(void **, const char * type, size_t s, size_t n);
/**
* General info event (sent to cluster log)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment