Question: I need to process a huge XML file, 4G. I used dom4j SAX, but wrote my own DefaultElementHandler. Code framework as below:

```
SAXParserFactory sf = SAXParserFactory.newInstance();   
SAXParser sax = sf.newSAXParser();   
sax.parse("english.xml", new DefaultElementHandler("page"){   
public void processElement(Element element) { 
// process the element
}
});    

```

I thought I was processing the huge file "page" by "page". But it seems not, as I always had the outof memory error. Did I miss anything important? Thanks. I am new to XML process.

Answer: 
You will need some assembly. This is becaused there are some privileged instructions that are needed for operating system design that will not be generated by a C/C++ compiler.

One example is when userside code want to make use of an operating system service (like interprocess communication) it needs to switch from user mode into kernel mode. This is normally done by issuing a Software Interrupt (SWI). A C++ will never create the SWI instruction.

Similarly, when writing an arbitrary precision integer arithmatic library, one will need to find of the value of the Carry Bit. There is no C/C++ operator that can do this for you. You will have to use assembler.

Incidentation, writing directly to a device register can and often is done in C. the volatile keyword is placed into the language specifically for registers whose values can change unexpectedly
You could program a complete OS in C++ if you were so inclined (and had a decade or so to spare....) since it does compile to machine code.

It's probably not a 'beginner' task though, and to be honest, plain old C would be a better choice for system level stuff (both the Windows and Linux kernels use C).