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

推荐订阅源

H
Help Net Security
博客园 - Franky
GbyAI
GbyAI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
博客园_首页
MongoDB | Blog
MongoDB | Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recent Announcements
Recent Announcements
Scott Helme
Scott Helme
有赞技术团队
有赞技术团队
M
MIT News - Artificial intelligence
C
CERT Recently Published Vulnerability Notes
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Jina AI
Jina AI
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
L
LangChain Blog
L
LINUX DO - 最新话题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Hacker News: Front Page
MyScale Blog
MyScale Blog
P
Palo Alto Networks Blog
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
AI
AI
T
Troy Hunt's Blog
Microsoft Azure Blog
Microsoft Azure Blog
阮一峰的网络日志
阮一峰的网络日志
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
S
Secure Thoughts
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
S
Security @ Cisco Blogs
Cloudbric
Cloudbric
E
Exploit-DB.com RSS Feed
Attack and Defense Labs
Attack and Defense Labs

博客园 - 吴尔平

gtest 的彩色信息输出 + boost.test 的内存泄漏检测及定位 在低版本的 vc 中使用 vc 10.0 的新特性 使用另一个blog: http://blog.csdn.net/WuErPing scons + swig 如何在 vista 使用 Device Emulator 连接internet vc9 Feature Pack Beta tr1 的一些问题 NSIS Kill Process (转贴) C#与一个彩票页面 - 吴尔平 - 博客园 py2exe 转换 pytetris - 吴尔平 关于模板化的friend class C# 的 random shuffle python 读取 windows event log 的简短代码 IronPython 1.0 Release Candidate (转贴 ( 据说比c实现的快1.5!) ) Visual Studio Service Pack (转贴) The 16th Annual Jolt Product Excellence Award Winners (转贴) C++/CLI FAQ (逐步整理中) C++/CLI singleton模式 (双重检测锁实现) 如何在 VS2005 的 Team Unit Testing frameworks 中测试 Native Code (C++ ) 改变 SQL Server 2000 所有对象的所有者
2005 CRT memory leaks
吴尔平 · 2006-01-01 · via 博客园 - 吴尔平

    看了7cat转了个贴子,才发现用VC2005之前有件很重要的事要做,一件非常重要的事情,重要到不做这件事情,你无法使用VC2005。因为:

     2005 CRT memory leaks: std::basic_iostream ( affects std::stringstream, std::fstream, probably others )!!!

    这真是件让人郁闷的事情!下面的代码将重现这个错误:

 1 #include <sstream>
 2 
 3 int main()
 4 {
 5     unsigned int x = 10000000;
 6     while( x-- )
 7     {
 8         std::iostream s(0);
 9     }
10 }

  • VS 2003 SP1 is scheduled for April 2006.  We have done much of the work for this release already, and are anxious to get it to you.
  • VS 2005 SP1 is scheduled for the first half of 2006.  We will be more specific about the date in a few months, once we have more customer data.

手动操作的说明:

References:

P.J. Plauger, Dinkumware - Supplied the modified constructors.

"Building the Run-Time Libraries, MSDN2 online, http://msdn2.microsoft.com/en-us/library/k9a8ehy3.aspx - How to rebuild the MSVC runtime libraries.

Workaround Steps:
1. Change the relevant constructor in

{C:\Program Files\Microsoft Visual Studio 8}\vc\include\istream and
{C:\Program Files\Microsoft Visual Studio 8}\vc\crt\src\istream
* directory between {} is the location of the MSVC 8 install directory

explicit __CLR_OR_THIS_CALL basic_iostream(basic_streambuf<_Elem,_Traits> *_Strbuf)
: basic_istream<_Elem, _Traits>(_Strbuf, false),
basic_ostream<_Elem, _Traits>(_Noinit, false)
{ // construct from stream buffer pointer
}

注:修改前内容
 explicit __CLR_OR_THIS_CALL basic_iostream(basic_streambuf<_Elem, _Traits> *_Strbuf)
  : basic_istream<_Elem, _Traits>(_Strbuf, false),
   basic_ostream<_Elem, _Traits>(_Strbuf)
  { // construct from stream buffer pointer
  }


2. Change the relevant constructor in

{C:\Program Files\Microsoft Visual Studio 8}\vc\include\ostream and
{C:\Program Files\Microsoft Visual Studio 8}\vc\crt\src\ostream

__CLR_OR_THIS_CALL basic_ostream(_Uninitialized, bool _Addit = true)
{ // construct uninitialized
if (_Addit)
ios_base::_Addstd(this); // suppress for
iostream
}

注修改前内容:
     __CLR_OR_THIS_CALL basic_ostream(_Uninitialized)
      { // construct uninitialized
      ios_base::_Addstd(this);
      }

3. Rebuild the MSVC libraries by running:

{C:\Program Files\Microsoft Visual Studio 8}\vc\crt\src\bldnt.cmd
* See reference link from description for details on rebuilding the MSVC libraries.

注:注意使用前需要设置一个环境变量,makefile文件中有相关说明
    # If your MSVC++ 8.0 installation is not in the default installation path
    # of "\Program Files\Microsoft Visual Studio 8\VC" on the current drive,
    # set the environment variable VCTOOLS to point to the main directory
    # of your installation.  (For example, "set VCTOOLS=C:\VS.NET\VC8")

4. Modify the Visual Studio project files

a. Properties->Linker->Input , "Ignore Specific Libraries" : msvcprt.lib;msvcrt.lib
b. Properties->Linker->Input, "Additional Dependencies" :
"{C:\Program Files\Microsoft Visual Studio 8}\vc\crt\src\build\intel\sample_p.lib"
"{C:\Program Files\Microsoft Visual Studio 8}\vc\crt\src\build\intel\_sample_.lib"
* Refer to reference link from description on details of the file naming.

5. Put the sample_p.dll and _sample_.dll in the same directory as your app ( or follow the rules for side-by-side deployment).