摘要:
小结:常用的gdb命令backtrace 显示程序中的当前位置和表示如何到达当前位置的栈跟踪(同义词:where) breakpoint 在程序中设置一个断点 cd 改变当前工作目录 clear 删除刚才停止处的断点 commands 命中断点时,列出将要执行的命令 continue 从断点开始继续执行 delete 删除一个断点或监测点;也可与其他命令一起使用 display 程序停止时显示变量和表达时 down 下移栈帧,使得另一个函数成为当前函数 frame 选择下一条continue命令的帧 info 显示与该程序有关的各种信息 jump 在源程序中的另一点开始运行 kill 异常终止 阅读全文
摘要:
JDK7:public final int hashCode() { return Objects.hashCode(getKey()) ^ Objects.hashCode(getValue()); }/** * Retrieve object hash code and applies a supplemental hash function to the * result hash, which defends against poor quality hash functions. This is * critical because HashMap uses power-of-two 阅读全文
摘要:
http://blog.csdn.net/feixiaoxing/article/details/6746543 内存越界是我们软件开发中经常遇到的一个问题。不经意间的复制常常导致很严重的后果。经常使用memset、memmove、strcpy、strncpy、strcat、sprintf的朋友肯定对此印象深刻,下面就是我个人在开发中实际遇到的一个开发问题,颇具典型。[cpp] view plaincopy#defineMAX_SET_STR_LENGTH50#defineMAX_GET_STR_LENGTH100int*process(char*pMem,intsize){charlocal 阅读全文
摘要:
http://blog.csdn.net/feixiaoxing/article/details/6746335在 我们个人编程的过程当中,内存泄露虽然不会像内存溢出那样造成各种莫名奇妙的问题,但是它的危害也是不可忽视的。一方面,内存的泄露导致我们的软件在运行 过程中占用了越来越多的内存,占有资源而又得不到及时清理,这会导致我们程序的效率越来越低;另一方面,它会影响我们用户的体验,失去市场的竞争能力。 常见的内存泄露是这样的:[cpp] view plaincopyvoidprocess(intsize){char*pData=(char*)malloc(size);/*othercode*/ 阅读全文
摘要:
http://my.oschina.net/pollybl1255/blog/140323BSS段:(bss segment)通常是指用来存放程序中未初始化的全局变量的一块内存区域。BSS是英文Block Started by Symbol的简称。BSS段属于静态内存分配。 数据段 :数据段(data segment)通常是指用来存放程序中 已初始化 的 全局变量 的一块内存区域。数据段属于静态内存分配。 代码段: 代码段(code segment/text segment)通常是指用来存放 程序执行代码 的一块内存区域。这部分区域的大小在程序运行前就已经确定,并且内存区域通常属于... 阅读全文