Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: replace new/delete with smart pointers #1493

Merged
merged 28 commits into from
May 22, 2023

Conversation

iiiuwioajdks
Copy link
Contributor

@iiiuwioajdks iiiuwioajdks commented May 12, 2023

fix #1477

存在 shared_ptr 的三处地方:
1.析构函数会有互相调用的问题
2.lock 之前的设计就是 shared_ptr,这方面暂时没改,就迎合之前的设计
3.Partition 类是 enable_shared_from_this 的,里面的字段设置成 shared_ptr 会更合理

目前除 net 包下由 chenjunhua 完成外,其余的已经基本完成,还有剩下的几个指针比较难改造,可以之后对代码更熟悉之后另开 pr

iiiuwioajdks and others added 3 commits May 10, 2023 23:00
ps: Not all new/delete are eliminated, as there are some variables that are not suitable for applying smart ptr, such as handle_, response_, request_ etc..., I chose to keep them as they were.
@iiiuwioajdks iiiuwioajdks changed the title 使用智能指针替换 new/delete replace new/delete with smart pointers May 12, 2023
@iiiuwioajdks
Copy link
Contributor Author

涉及 #1477 的部分修改

src/storage/src/redis.h Outdated Show resolved Hide resolved
@Tangruilin
Copy link
Collaborator

把 PR 的标题都改一下

@Tangruilin
Copy link
Collaborator

[task #xxx] msg 这种格式,这样可以直接关联到 issue

@iiiuwioajdks iiiuwioajdks changed the title replace new/delete with smart pointers [task #1477]replace new/delete with smart pointers May 13, 2023
@wanghenshui wanghenshui changed the title [task #1477]replace new/delete with smart pointers fix: replace new/delete with smart pointers May 15, 2023
@wanghenshui
Copy link
Collaborator

评论 fix #xxx 来关联。标题尽可能概括。

src/pika_binlog.cc Outdated Show resolved Hide resolved
src/pika_consensus.cc Outdated Show resolved Hide resolved
@iiiuwioajdks iiiuwioajdks changed the title fix: replace new/delete with smart pointers [WIP]fix: replace new/delete with smart pointers May 16, 2023
include/pika_consensus.h Outdated Show resolved Hide resolved
src/pika_cmd_table_manager.cc Outdated Show resolved Hide resolved
@iiiuwioajdks iiiuwioajdks changed the title [WIP]fix: replace new/delete with smart pointers fix: replace new/delete with smart pointers May 19, 2023
@cr-gpt
Copy link

cr-gpt bot commented May 22, 2023

Seems you are using me but didn't get OPENAI_API_KEY seted in Variables/Secrets for this repo. you could follow readme for more information

@AlexStocks AlexStocks merged commit 07b2c6d into OpenAtomFoundation:unstable May 22, 2023
10 checks passed
bigdaronlee163 pushed a commit to bigdaronlee163/pika that referenced this pull request Jun 8, 2024
* [feat] change storage new/del to smartp

* Eliminated new/delete using smart ptr within src/net/.
ps: Not all new/delete are eliminated, as there are some variables that are not suitable for applying smart ptr, such as handle_, response_, request_ etc..., I chose to keep them as they were.

* [feat] replace new/delete with smart pointers

* fix build

* change shared_ptr to unique_ptr

* change to auto

* feat

* removed an unnecessary shared_ptr and use unique_ptr instead.

* change pstd/

* revised a comment

* change pstd implement

* remove code of jh

* fix tools build

* fix

* feature

* fix

* fix

---------

Co-authored-by: cjh <1271435567@qq.com>
Co-authored-by: laimuxi <laimuxi@bytedance.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

delete all new/delete in Pika and use shared_ptr/unique_ptr instead
6 participants