Li Sheng | Backend / Distributed Storage Engineer Li Sheng | Backend / Distributed Storage Engineer
Home
Resume
Projects
Topics
Notes
GitHub (opens new window)
Home
Resume
Projects
Topics
Notes
GitHub (opens new window)
  • Go语言

  • C++

    • 内存相关

    • 面向对象

    • STL相关

    • 内置数据结构
    • 数据结构示例
    • go和c++对比
    • 关键字

      • static
      • const、volatile、mutable
      • const_cast、dynamic_cast
      • struct、class、union
      • new、delete
      • operator
      • c++20 range
  • 算法题

  • 存储系统

  • CephFS

  • 分布式系统

  • 计算机网络

  • Redis与缓存

  • Kubernetes

  • 技术笔记
  • C++
  • 关键字
lisheng
2024-09-10

new、delete

11、new、delete new、delete属于操作符,可以被重载。new表示向内存申请一段新的空间,申请失败会抛出异常。new会先调用operator new函数,再在operator new函数里调用malloc函数分配空间,然后再调构造函数。delete不仅会清理资源,还会释放空间。delete县调用析构函数,其次调用operator delete函数,最后在operator delete函数里面调用free函数。malloc申请内存失败会返回空。free只是清理了资源,并没有释放空间。

Edit (opens new window)
Last Updated: 2026/04/27, 13:46:33
struct、class、union
operator

← struct、class、union operator→

最近更新
01
待完成专题池
04-28
02
待完成专题池
04-28
03
为什么 Kubernetes CSI 插件架构要拆成 Controller、Node 与 Sidecar
04-28
更多文章>
Theme by Vdoing
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式