1.内存管理

1.1 进程中的内存区域划分

代码区   仅仅读常理区    全局区    BSS     堆   栈

1.2 字符串存储形式之间的比較

字符指针,字符数组。字符动态内存

1.3 虚拟内存管理技术

Unix/Linux系统总的内存都是採用虚拟内存管理技术进行管理。即:每一个进程都有0~4G的内存地址

(虚拟的并非真实存在的),由操作系统负责把内存地址和真实的物理内存映射起来,因此,不同进程

的内存地址看起来是一样的,可是所相应的物理内存是不一样的。

用户空间 0~3G。 虚拟内核空间3~4G

1.4 段错误的由来

(1)scanf函数缺少 &

(2)空指针、野指针的使用

(3)师徒使用一个没有经过映射的虚拟地址可能引发段错误

1.5使用malloc申请动态内存的特性

须要额外的12个字节用于存储管理动态内存信息

採用链表的方式处理多个内存块

使用malloc千万不要越界

(2)使用malloc 申请内存的一般映射

一般说来。使用malloc申请较小的内存时,操作系统一次性分配33个内存页

#include <unistd.h>

getpid() 获取当前进程的进程号

cat / proc/ 进程号/maps 查看指定进程的内存分配情况

1.6使用free释放动态内存特性

1.7 内存处理相关函数

(1)getpagesize 函数

函数功能:

主要用于获取当前系统中一个内存页大小。一般为4kb

(2)sbrk函数

#inlcude <unistd.h>

void *sbrk(intptr_t increment);

(3)brk函数

int brk(void *addr);

sbrk 申请 brk 释放

Summary Day30的更多相关文章

  1. Summary of Critical and Exploitable iOS Vulnerabilities in 2016

    Summary of Critical and Exploitable iOS Vulnerabilities in 2016 Author:Min (Spark) Zheng, Cererdlong ...

  2. 三个不常用的HTML元素:<details>、<summary>、<dialog>

    前面的话 HTML5不仅新增了语义型区块级元素及表单类元素,也新增了一些其他的功能性元素,这些元素由于浏览器支持等各种原因,并没有被广泛使用 文档描述 <details>主要用于描述文档或 ...

  3. [LeetCode] Summary Ranges 总结区间

    Given a sorted integer array without duplicates, return the summary of its ranges. For example, give ...

  4. Network Basic Commands Summary

    Network Basic Commands Summary set or modify hostname a)     temporary ways hostname NEW_HOSTNAME, b ...

  5. Summary - SNMP Tutorial

    30.13 Summary Network management protocols allow a manager to monitor and control routers and hosts. ...

  6. Mac Brew Install Nginx Summary

    ==> Downloading https://homebrew.bintray.com/bottles/nginx-1.10.1.el_capitan.bot################# ...

  7. Leetcode: LFU Cache && Summary of various Sets: HashSet, TreeSet, LinkedHashSet

    Design and implement a data structure for Least Frequently Used (LFU) cache. It should support the f ...

  8. How to add taxonomy element to a summary view?

    [re: Orchard CMS] This caused me scratching my head for days and now I can even feel it's bleeding. ...

  9. (转) Summary of NIPS 2016

    转自:http://blog.evjang.com/2017/01/nips2016.html           Eric Jang Technology, A.I., Careers       ...

随机推荐

  1. java接口理解(转载)

    今天和同事好好的讨论了java接口的原理和作用,发现原来自己的对接口的理解仅仅是局限在概念的高度抽象上,觉得好像理解了但是不会变化应用其实和没有理解差不多.以前看一个帖子说学习一个东西不管什么时候都要 ...

  2. 关于cook操作

    http://www.cnblogs.com/fishtreeyu/archive/2011/10/06/2200280.html

  3. 最大子段和 模板题 51Nod 1049

    N个整数组成的序列a[1],a[2],a[3],…,a[n],求该序列如a[i]+a[i+1]+…+a[j]的连续子段和的最大值.当所给的整数均为负数时和为0. 例如:-2,11,-4,13,-5,- ...

  4. groupmod---更改群组识别码或名称

    groupmod命令用于更改群组识别码或名称. 需要更改群组的识别码或名称时,可用groupmod指令来完成这项工作. 语法 groupmod [-g <群组识别码> <-o> ...

  5. HDU——T 3746 Cyclic Nacklace

    http://acm.hdu.edu.cn/showproblem.php?pid=3746 Time Limit: 2000/1000 MS (Java/Others)    Memory Limi ...

  6. BZOJ 1009 GT考试 (AC自动机 + 矩阵乘法加速dp)

    题目链接: https://www.lydsy.com/JudgeOnline/problem.php?id=1009 题意: 准考证号为\(n\)位数\(X_1X_2....X_n(0<=X_ ...

  7. jQuery返回值:jQuery对象

    $(function(){ //返回值 alert($); //jQuery //以下返回的全是jQuery对象 alert($()); alert($('#box')); alert($('#box ...

  8. 【SonicUI】关于字体高亮的问题。。

    m_pSonicString[1]->Format(_T("/c=%x, a='http://hi.csdn.net/', linkh=0xFF00F0, font, font_hei ...

  9. Nginx分发服务

    nginx配置分发tomcat服务 http://blog.csdn.net/yan_chou/article/details/53265775 http://www.cnblogs.com/deng ...

  10. STL_算法_删除(unique、unique_copy)

    C++ Primer 学习中. . . 简单记录下我的学习过程 (代码为主) 全部容器适用 unique(b,e) unique(b,e,p) unique_copy(b1,e1,b2) unique ...