Commit 849d42af authored by joreland@mysql.com's avatar joreland@mysql.com

Clear in chucks of 128k with watch_dog refresh in between

parent 294958a7
...@@ -639,7 +639,7 @@ void* ...@@ -639,7 +639,7 @@ void*
SimulatedBlock::allocRecord(const char * type, size_t s, size_t n, bool clear) SimulatedBlock::allocRecord(const char * type, size_t s, size_t n, bool clear)
{ {
void* p = NULL; void * p = NULL;
size_t size = n*s; size_t size = n*s;
refresh_watch_dog(); refresh_watch_dog();
if (size > 0){ if (size > 0){
...@@ -662,8 +662,18 @@ SimulatedBlock::allocRecord(const char * type, size_t s, size_t n, bool clear) ...@@ -662,8 +662,18 @@ SimulatedBlock::allocRecord(const char * type, size_t s, size_t n, bool clear)
ERROR_SET(fatal, ERR_MEMALLOC, buf1, buf2); ERROR_SET(fatal, ERR_MEMALLOC, buf1, buf2);
} }
if(clear) if(clear){
memset(p, 0, size); char * ptr = (char*)p;
const Uint32 chunk = 128 * 1024;
while(size > chunk){
refresh_watch_dog();
memset(ptr, 0, chunk);
ptr += chunk;
size -= chunk;
}
refresh_watch_dog();
memset(ptr, 0, size);
}
} }
return p; return p;
} }
......
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