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

【Hackathon 6th Fundable Projects 2 No.19】cppcoreguidelines-no-malloc-final #63752

Merged
merged 17 commits into from
May 22, 2024

Conversation

walkalone20
Copy link
Contributor

@walkalone20 walkalone20 commented Apr 22, 2024

PR Category

Others

PR Types

Bug fixes

Description

修复了 C 风格的 malloc、free 的共计 23 个错误。该问题共 27 处,还有 4 处涉及到函数参数是指针,在函数内或跨函数释放的情况:

/paddle/Paddle/paddle/phi/api/profiler/device_tracer.cc:179:46: error: do not manage memory manually; consider a container or a smart pointer [cppcoreguidelines-no-malloc,-warnings-as-errors]
  uint8_t *buf = reinterpret_cast<uint8_t *>(malloc(kBufSize + kAlignSize));
                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/paddle/Paddle/paddle/fluid/framework/new_executor/workqueue/workqueue_utils.cc:49:3: error: do not manage memory manually; use RAII [cppcoreguidelines-no-malloc,-warnings-as-errors]
  free(mem_ptr);
  ^~~~~~~~~~~~~
/paddle/Paddle/paddle/pir/src/core/utils.cc:51:3: error: do not manage memory manually; use RAII [cppcoreguidelines-no-malloc,-warnings-as-errors]
  free(mem_ptr);
  ^~~~~~~~~~~~~
/paddle/Paddle/paddle/phi/api/profiler/device_tracer.cc:309:3: error: do not manage memory manually; use RAII [cppcoreguidelines-no-malloc,-warnings-as-errors]
  free(buffer);
  ^~~~~~~~~~~~

相关链接:
#54073

@CLAassistant
Copy link

CLAassistant commented Apr 22, 2024

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link

paddle-bot bot commented Apr 22, 2024

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot bot added the contributor External developers label Apr 22, 2024
Galaxy1458
Galaxy1458 previously approved these changes Apr 24, 2024
Copy link

paddle-ci-bot bot commented May 1, 2024

Sorry to inform you that 9844a3b's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

Copy link

paddle-ci-bot bot commented May 9, 2024

Sorry to inform you that ae6e00e's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

@luotao1 luotao1 changed the title 【Hackathon 6th Fundable Projects 2 No.1】Fix cppcoreguidelines-no-malloc 【Hackathon 6th Fundable Projects 2 No.19】cppcoreguidelines-no-malloc-final May 16, 2024
@luotao1 luotao1 merged commit fd87356 into PaddlePaddle:develop May 22, 2024
32 checks passed
@walkalone20 walkalone20 deleted the no-malloc branch May 22, 2024 07:39
co63oc pushed a commit to co63oc/Paddle that referenced this pull request May 23, 2024
…final (PaddlePaddle#63752)

* no-malloc fix

* minor changes

* minor changes

* minor changes

* minor changes

* interface value update

* minor changes

* linter

* capi fix

* restore

* minor changes

* format

* minor changes

* Update interface_value.h

* Update interface_value.h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants