This post if part of a series about the File System Toolkit - a custom content delivery API for SDL Tridion. In previous post Writing My Own Database Engine , I quickly mentioned the use of Memory Byte Buffer from Jana NIO that provides fast access to a file by mapping its content to memory. This post goes into more detail over some tricks that occurred with that implementation. There is an issue with Memory Byte Buffer. Namely, once it is created by calling FileChannel.map method, it cannot be unmapped, closed or discarded. The byte buffer will exist until it is garbage collected. From the JavaDoc: A mapping, once established, is not dependent upon the file channel that was used to create it. Closing the channel, in particular, has no effect upon the validity of the mapping. A mapped byte buffer and the file mapping that it represents remain valid until the buffer itself is garbage-collected. The issue is affects Windows OS Java implementations, in the sense that it keep
talk is cheap. show me the code.