zoukankan      html  css  js  c++  java
  • 烫烫烫烫烫屯屯屯屯

    #include<iostream>
    using namespace std;
    int main()
    {
    	char *s = (char*)malloc(10);
    	cout<<s<<endl;
    	char p[10];
    	cout<<p<<endl;
    }
    



    出现以上原因都是由于内存没有初始化造成的,而对于栈中内存如果没有初始化,则会出现“烫烫烫烫烫烫”。对于堆中内存如果没有初始化,则会出现“屯屯屯屯屯”,有时候我们的数组没有结束符,输出数组也会有这些汉字的出现,就是因为没有结束符占用了后面的空闲的内存块即没有初始化的内存块


    =============================

    Value     Name           Description  
    ------   --------        ------------------------- 
    0xCD     Clean Memory    Allocated memory via malloc or new but never  
                              written by the application.  
      
    0xDD     Dead Memory     Memory that has been released with delete or free.  
                              Used to detect writing through dangling pointers.  
      
    0xFD     Fence Memory    Also known as "no mans land." This is used to wrap  
                              the allocated memory (surrounding it with a fence)  
                              and is used to detect indexing arrays out of  
                              bounds or other accesses (especially writes) past 
                              the end (or start) of an allocated block. 
      
    0xCC                     When the code is compiled with the /GZ option, 
                              uninitialized variables are automatically assigned  
                              to this value (at byte level).  
      
      
    // the following magic values are done by the OS, not the C runtime: 
      
    0xAB  (Allocated Block?) Memory allocated by LocalAlloc().  
      
    0xBAADF00D Bad Food      Memory allocated by LocalAlloc() with LMEM_FIXED,but  
                              not yet written to.  
      
    0xFEEEFEEE               OS fill heap memory, which was marked for usage,  
                              but wasn't allocated by HeapAlloc() or LocalAlloc().  
                              Or that memory just has been freed by HeapFree(). 


  • 相关阅读:
    404页面应该怎么做?
    网站被百度和google封了,怎么办?
    如何下载没有提供下载按钮的网页视频
    新手学习.net编程计划-1
    windows7旗舰版下载出现蓝屏代码50怎么办?
    微软已于10月底停止销售预装Windows 7/8.1的电脑
    Html代码seo优化最佳布局实例讲解
    下载类网站的SEO优化方面技巧
    命名空间“System.Windows.Forms”中不存在类型或命名空间名称“DataVisualization”。是否缺少程序集引用?
    SQL、LINQ、Lambda 三种用法(转)
  • 原文地址:https://www.cnblogs.com/lgh1992314/p/5835326.html
Copyright © 2011-2022 走看看