Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting oversubscribed dynamic bit lengths tre  RSS feed

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

For the high performance and optimized caching mechanism, we're cashing java objects in-memory.

Following are the code snippets which I wrote to do in-memory compression / decompression of the java objects.

I'm compressing java objects in-memory and storing compressed data in bytes array, whenever it's required to use, I just uncompress it in memory and use it and then again dump (garbage) it when use is finished.

Instead of keeping real objects, I'm keeping compressed object bytes in memory to save huge memory.

I'm getting deadly java error while decompressing data, the error is as under,

Caused by: oversubscribed dynamic bit lengths tree

I don't know what's wrong with it.

I tried creating many sample programs also with huge data, but it worked fine in case of standalone applicatoin but in J2EE application its not working with real time data.

Following is the code to compress and decompress data.

Following is the code to compress the data

Object obj = new String("hello world"); // some objects
ByteArrayOutputStream baos = new ByteArrayOutputStream();
GZipOutputStream gos = new GZipOutputStream(baos);
ObjectOutputStream oos = new ObjectOutputStream(gos);
byte[] compressedData = baos.toBytesArray();

Following code is to decompress the data

ByteArrayInputStream baos = new ByteArrayInputStream(compressedData);
GZipInputStream gos = new GZipInputStream(baos);
ObjectInputStream oos = new ObjectInputStream(gos);
obj = oos.readObject();

Does any body have any idea about how to get a rid of this problem.

If it does happen due to GZip input/output stream, is there any alternate solutions to compress/decompress data and store as a bytes array in memory.

Thanks & Regards
Tanmay Parikh
We begin by testing your absorbancy by exposing you to this tiny ad:
ScroogeXHTML 7.2 - RTF to HTML5 / XHTML converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!