惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

M
MIT News - Artificial intelligence
有赞技术团队
有赞技术团队
S
Schneier on Security
aimingoo的专栏
aimingoo的专栏
T
Troy Hunt's Blog
U
Unit 42
Hacker News - Newest:
Hacker News - Newest: "LLM"
V2EX - 技术
V2EX - 技术
T
The Blog of Author Tim Ferriss
V
Visual Studio Blog
H
Heimdal Security Blog
H
Hacker News: Front Page
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
Cloudbric
Cloudbric
Google DeepMind News
Google DeepMind News
C
Cisco Blogs
The Cloudflare Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
MyScale Blog
MyScale Blog
F
Fortinet All Blogs
N
News | PayPal Newsroom
Attack and Defense Labs
Attack and Defense Labs
D
DataBreaches.Net
N
News and Events Feed by Topic
Security Archives - TechRepublic
Security Archives - TechRepublic
Forbes - Security
Forbes - Security
Simon Willison's Weblog
Simon Willison's Weblog
F
Full Disclosure
The Register - Security
The Register - Security
L
LINUX DO - 热门话题
Webroot Blog
Webroot Blog
Google Online Security Blog
Google Online Security Blog
AI
AI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
I
Intezer
S
Security Affairs
阮一峰的网络日志
阮一峰的网络日志
K
Kaspersky official blog
云风的 BLOG
云风的 BLOG
博客园 - 叶小钗
T
Threatpost
Spread Privacy
Spread Privacy
小众软件
小众软件
AWS News Blog
AWS News Blog
S
Secure Thoughts
S
Security @ Cisco Blogs
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
J
Java Code Geeks

博客园 - Jacky

Four early-PayPal entrepreneurial culture norms →How Facebook Ships Code Constraints on Type Parameters (C# Programming Guide) An Introduction to C# Generics http://arstechnica.com Scaling memcached at Facebook httpserver,下面是rfc相关信息: 目前互联网上公布出来的正文提取算法,大家可以综合比较下,一起来测试下哪个更好用。 词网--北京词网科技有限公司 http://demo.cikuu.com/cgi-bin/cgi-contex 猎兔网页正文提取 http://www.lie In a nutshell: A Basic Comparison of Heap-Sort and Quick-Sort Algorithms C#中string.Format的格式参数问题 - Jacky - 博客园 mit 2 mit Process Monitor监测记录表明,QQ不仅会自动访问许多与聊天无关的程序和文档,例如“我的文档”等敏感位置,测试当天的上网记录也没能幸免。随后,QQ还会产生大量网络通讯,很可能是将数据上传到腾讯服务器。短短10分钟内,它访问的无关 搜索引擎高级搜索技巧 harvard 十年了,馅饼西施的馅饼还是那么正 她讲课的缺点是讲起课来波澜不惊,按着课本步步来.容易看不下去,不过确实能进一步学到一些知识。喜欢的顶起来 9。指针参数的内存传递。 - Jacky - 博客园 模块间调用重载new和delete问题
转 内存泄露检测,重载new
Jacky · 2010-10-23 · via 博客园 - Jacky

//mem_check.h
#ifndef MEM_CHECK_H
#define MEM_CHECK_H
#ifdef _DEBUG
//两个东西:重载new,重定义new参数
void* operator new(size_t size, const char *file_name,long line);
void* operator new[](size_t size, const char *file_name,long line);
void operator delete(void *);
void operator delete[](void *);
//重载完之后,new操作符的参数事实上还是一个,因此重定义一下new,使之有3个操作符
#define new new(__FILE__,__LINE__)
#endif
#endif

//mem_check.cpp
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
#ifdef _DEBUG
namespace {//匿名空间的使用
    struct info{
        void *ptr;
        const char *file_name;
        long line;
    };
    info ptr_list[1024];
    unsigned int ptrn=0;

    int find_ptr(void *p){
        for(int i=0;i<ptrn;i++){
            if(ptr_list[i].ptr==p)
                return i;
        }
        return -1;
    }

    void del_ptr(int i){
        while(i+1<ptrn){
            ptr_list[i]=ptr_list[i+1];
            i++;
        }
        ptrn--;
    }

    class process_end{
    public:
        ~process_end(){
            for(int i=0;i<ptrn;i++){
                cout<<ptr_list[i].file_name<<"  line:"<<ptr_list[i].line<<" memory leak"<<endl;
            }
        }
    };
    process_end pe;
}//匿名空间结束

void* operator new(size_t size, const char *file_name,long line){
    void *p=malloc(size);
    ptr_list[ptrn].ptr=p;
    ptr_list[ptrn].file_name=file_name;
    ptr_list[ptrn].line=line;
    ptrn++;
    return p;
}

void* operator new[](size_t size, const char *file_name,long line){
    return operator new(size,file_name,line);
}

void operator delete(void *p){
    int i=find_ptr(p);
    if(i>=0){
        free(p);
        del_ptr(i);
    }else{
        cout<<"delete unknown pointer"<<endl;
    }
}

void operator delete[](void *p){
    operator delete(p);
}
#endif

//main.cpp

#include <iostream>
#include "mem_check.h"//必须最后include
using namespace std;
int main(){
    int *p=new int;
    delete p;
    delete p;
    int *r=new int[5];
}

最后给一个介绍重载new new[] delete delete[]的页面
http://zhidao.baidu.com/question/31574989.html?fr=qrl&cid=866&index=4&fr2=query