Summary Day30
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的更多相关文章
- Summary of Critical and Exploitable iOS Vulnerabilities in 2016
Summary of Critical and Exploitable iOS Vulnerabilities in 2016 Author:Min (Spark) Zheng, Cererdlong ...
- 三个不常用的HTML元素:<details>、<summary>、<dialog>
前面的话 HTML5不仅新增了语义型区块级元素及表单类元素,也新增了一些其他的功能性元素,这些元素由于浏览器支持等各种原因,并没有被广泛使用 文档描述 <details>主要用于描述文档或 ...
- [LeetCode] Summary Ranges 总结区间
Given a sorted integer array without duplicates, return the summary of its ranges. For example, give ...
- Network Basic Commands Summary
Network Basic Commands Summary set or modify hostname a) temporary ways hostname NEW_HOSTNAME, b ...
- Summary - SNMP Tutorial
30.13 Summary Network management protocols allow a manager to monitor and control routers and hosts. ...
- Mac Brew Install Nginx Summary
==> Downloading https://homebrew.bintray.com/bottles/nginx-1.10.1.el_capitan.bot################# ...
- 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 ...
- 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. ...
- (转) Summary of NIPS 2016
转自:http://blog.evjang.com/2017/01/nips2016.html Eric Jang Technology, A.I., Careers ...
随机推荐
- Kinect 开发 —— 近距离探测
如何将Kinect设备作为一个近距离探测传感器.为了演示这一点,我们处理的场景可能在以前看到过.就是某一个人是否站在Kinect前面,在Kinect前面移动的是人还是什么其他的物体.当我们设置的触发器 ...
- CSU 1046 追杀
Description 在一个8行9列的国际象棋棋盘上,有一名骑士在追杀对方的国王.该骑士每秒跨越一个2*3的区域,如下图所示. 而对方的国王慌忙落逃,他先沿着右下斜线方向一直跑,遇到边界以后会沿着光 ...
- Centos安装FastDFS+Nginx(一天时间搞定)
最近在研究和使用Fastdfs,别人搭的环境,终究是别人的,绝知此事要躬行~躬行啊~ 下面的脚本主要参考了官方的INSTALL文件,这个是比较权威的,部分地方和实际情况不一致.比如配置文件的 ...
- [Redux-Observable && Unit testing] Testing the output of epics
Epics can be unit-tested just like any other function in your application - they have a very specifi ...
- [Python] Python's namedtuples can be a great alternative to defining a class manually
# Why Python is Great: Namedtuples # Using namedtuple is way shorter than # defining a class manuall ...
- 用djbdns为域名解析服务护航
上期回顾:http://chenguang.blog.51cto.com/350944/292195 650) this.width=650;" alt="&quo ...
- 用jersey写 java restfull web services 输出xml格式数据
1 logic package com.toic.rest; import com.toic.model.Folder; import java.util.logging.Logger; import ...
- golang beego cache
package main import ( "fmt" "github.com/astaxie/beego/cache" "time" ) ...
- JS错误记录 - To-do List
var data = (localStorage.getItem('todolist'))? JSON.parse(localStorage.getItem('todolist')) : { todo ...
- 【Todo】Zookeeper系列文章
http://nileader.blog.51cto.com/1381108/1068033