ITeye博客

zzy1943的博客

zzy1943 · 共 19 篇文章

C/C++语言中各种数据类型长度的总结[转]

下面是我关于C语言中各种数据类型长度的总结:(参考The C Programming Language) c语言中的整数类型有char, short, int, long等几种, 下面是C语言对每种数据类型长度的规定: (a). short和long类型的长度不相同 (b). int类型通常同具体机器的物理字长相同 (c). short通常是16bits, int通常是16bits or 32bits每种编译器可以根据硬件的不同自由确定, 但是short和int必须最少是16bits, 而long类型必须最少是32bits, 并且short必须比int和long类型要短。 sizeof() …

2010-07-26 09:48 · LINUX&LINUX C · 评论(0)

Java 内存管理原理、内存泄漏实例及解决方案研究【转】

为了判断Java中是否有内存泄露,我们首先必须了解Java是如何管理内存的。Java的内存管理就是对象的分配 和释放问题。在Java中,程序员需要通过关键字new为每个对象申请内存空间 (基本类型除外),所有的对象都在堆 (Heap)中分配空间。另外,对象的释放是由GC决定和执行的。在Java中,内存的分配是由程序完成的,而内存的释放是有GC完成的,这种收支两条线 的方法确实简化了程序员的工作。但同时,它也加重了JVM的工作。这也是Java程序运行速度较慢的原因之一。因为,GC为了能够正确释放对象,GC必须 监控每一个对象的运行状态,包括对象的申请、引用、被引用、赋值等,GC都需要进行监控。…

2010-07-23 14:13 · JAVASE · 评论(0)

String StringBuffer StringBuilder [转]

String 字符串常量 StringBuffer 字符串变量(线程安全) StringBuilder 字符串变量(非线程安全) 简要的说, String 类型和 StringBuffer 类型的主要性能区别其实在于 String 是不可变的对象, 因此在每次对 String 类型进行改变的时候其实都等同于生成了一个新的 String 对象,然后将指针指向新的 String 对象,所以经常改变内容的字符串最好不要用 String ,因为每次生成对象都会对系统性能产生影响,特别当内存中无引用对象多了以后, JVM 的 GC 就会开始工作,那速度是一定会相当慢的。 而如果是使用 StringBu…

2010-07-21 15:38 · JAVASE · 评论(0)

java 容器相关

The HashMap class is roughly equivalent to Hashtable, except that it is unsynchronized and permits nulls.

2010-05-08 15:47 · JAVASE · 评论(0)

容器Iterator的fail-fast

A structural modification is any operation that adds or deletes one or more elements, or explicitly resizes the backing array; merely setting the value of an element is not a structural modification. fail-fast: if the list is structurally modified at any time after the iterator is created, in any w…

2010-05-05 22:33 · JAVASE · 评论(0)

(3)chapter 5: The Java Virtual Machine II

The Class Loader Subsystem primordial class loader and class loader object The primordial class loader is a class loader implemented in JVM, and class loader object is the objects of classes that descend from ClassLoader. only types loaded by primordial class loader are stored in method area. Loadi…

2010-04-23 21:13 · inside JVM 读书笔记 · 评论(0)

(2)chapter 5: The Java Virtual Machine I

When talking JVM, it may refer any of these: the abstract specification a concrete implementation a runtime instance The life-cycle of instance of JVM Only one mission in the life of a instance of JVM: run one Java application. Inside one instance of JVM, threads come in tow flavor: daemon and non-…

2010-04-22 22:05 · inside JVM 读书笔记 · 评论(0)

(1)chaper 1: Introduction

Three advantages: platform independence security network-mobility These three facets of java's architecture work together to make java suitable for the emerging networked computing environment. The architecture: the java programming language the java class file format the java application programmi…

2010-04-22 20:37 · inside JVM 读书笔记 · 评论(0)

java Thread 状态转换图

2010-04-19 19:38 · 评论(0)

ClassLoader

今天研究了一下classloader,分享了一篇文章http://www.iteye.com/topic/83978 一直想找一本介绍JVM的书来看,这回算是找到了《inside JVM》。 顺便也写了一个测试程序: public class A { static{ System.out.println("static"); } public A(){ System.out.println("constructor"); } } public class TestLoader { /** * @param args */ public static void main(String[] ar…

2010-04-12 16:50 · JAVASE · 评论(0)

hadoop org.apache.hadoop.io.serializer包

hadoop的org.apache.hadoop.io.serializer包提供了一种可插拔的持久化框架(Pluggable Serialization Framework)。之所以说是可插拔的,是因为可以把现存的持久化方式嵌入到hadoop的程序中。这个包中有以下的一些类: 1、Serializer和Deserializer:这是两个接口,定义序列化和反序列化的接口。 2、Serialization:接口,定义一套序列化机制。 3、JavaSerilization:实现Serialization接口,并维护两个分别实现Serializer和Deserializer接口的内部类。这两个内部…

2010-04-08 21:11 · HADOOP&MAPREDUCE · 评论(0)

各种Serialization机制

这些天看到的关于持久化的内容比较多,这里做一些总结: 1、java api的持久化,主要靠两个类:ObjectOutputStream和ObjectInputStream 2、Hibernate 3、与云计算有关的: 1、hadoop的Writable接口实现的持久化 2、hadoop的org.apache.hadoop.io.serializer包中提供的持久化框架 3、hadoop的IO Record实现的持久化(org.apache.hadoop.record) 4、Apache Thrift 5、Google的Protocol Buffer(google的关于SawZall的论文中提…

2010-04-08 19:56 · JAVASE · 评论(0)

Log4j的类图

2010-04-06 15:25 · Log4j · 评论(0)

[转]C中的const

C中的CONST C中CONST的使用: const是一个C语言的关键字,它限定一个变量不允许被改变。使用const在一定程度上可以提高程序的安全性和可靠性,另外,在观看别人代码的时候,清晰理解const所起的作用,对理解对方的程序也有一些帮助。 虽然这听起来很简单,但实际上,const的使用也是c语言中一个比较微妙的地方,微妙在何处呢?请看下面几个问题。 问题:const变量 & 常量 为什么下面的例子在使用一个const变量来初始化数组,ANSI C的编译器会报告一个错误呢? const int n = 5; int a; 答案与分析: 1)、这个问题讨论的是“常量”与“只读变量”的区别…

2010-04-06 15:18 · LINUX&LINUX C · 评论(0)

hadoop的序列化机制

hadoop不用java的serialization机制 doug cutting 是这样解释的: Why didn’t I use Serialization when we first started Hadoop? Because it looked big and hairy and I thought we needed something lean and mean, where we had precise control over exactly how objects are written and read, since that is central to Hadoop…

2010-04-06 15:15 · HADOOP&MAPREDUCE · 评论(0)