-
Notifications
You must be signed in to change notification settings - Fork 0
/
Object.cpp
38 lines (32 loc) · 746 Bytes
/
Object.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//
// Created by lk234 on 2020/10/22 022.
//
#include <thread>
#include "Object.h"
void * Object::operator new(size_t size) {
#ifdef DEBUG
std::cout << "Object operator new called\n";
#endif
return MemoryManager::getInstance()->operator new(size); // 调用ManageAllocate::operator new
}
void Object::operator delete(void *pointer) noexcept {
#ifdef DEBUG
std::cout << "Object operator delete called\n";
#endif
MemoryManager::getInstance()->operator delete(pointer);
}
std::string Object::objectName() const{
return objectName_;
}
/*
* 引用计数收集器[已弃用]
*/
/*
Object& Object::operator=(Object &obj) {
obj.refCount_ += 1;
return *this;
}
int Object::refCount() const {
return refCount_;
}
*/