| 286 | |
| 287 | |
| 288 | void* operator new(size_t sz) |
| 289 | { |
| 290 | // put alloc node in front of requested memory |
| 291 | void* ptr = malloc(sz + sizeof(alloc_node)); |
| 292 | if (ptr) { |
| 293 | if (Tracking) { |
| 294 | Lock l(mutex); |
| 295 | ++Allocs; |
| 296 | Bytes += sz; |
| 297 | ++sizes[powerOf2(sz)].count_; |
| 298 | insert(new (ptr) alloc_node); |
| 299 | } |
| 300 | return static_cast<char*>(ptr) + sizeof(alloc_node); |
| 301 | } |
| 302 | else |
| 303 | assert(0); |
| 304 | } |
| 305 | |
| 306 | |
| 307 | void operator delete(void* ptr) |
no test coverage detected