Java Serialization problem on very big stack

R

ronari2

All,

I have the following Data Structure:
A HashMap that his value is a simple object or another HashMap that can
have as a value object or HashMap.
I create a very deep (many levels) structure this way.

Eventually I need to serialize this object. I get StackOverflow even if
I increase the thread stack size (-XX:ThreadStackSize) to his maximumx
size.

I am working with JDK1.5

It will be very difficult for me to change this data strcture.

Is there any tools that can help me to serialize such object without
changin my data structure ?

Thanks,
Ronen.
 
O

Oliver Wong

All,

I have the following Data Structure:
A HashMap that his value is a simple object or another HashMap that can
have as a value object or HashMap.
I create a very deep (many levels) structure this way.

Eventually I need to serialize this object. I get StackOverflow even if
I increase the thread stack size (-XX:ThreadStackSize) to his maximumx
size.

I am working with JDK1.5

It will be very difficult for me to change this data strcture.

Is there any tools that can help me to serialize such object without
changin my data structure ?

Did you try implementing the readObject and writeObject methods?
http://java.sun.com/j2se/1.5.0/docs/api/java/io/Serializable.html

- Oliver
 
R

ronari

No I did not. I want some black box solution. It will be difficult to
implement it to all our structure.
 
E

EJP

I have the following Data Structure:
A HashMap that his value is a simple object or another HashMap that can
have as a value object or HashMap.
I create a very deep (many levels) structure this way.

How deep? Must be thousands or millions.
 
C

Chris Uppal

I have the following Data Structure:
A HashMap that his value is a simple object or another HashMap that can
have as a value object or HashMap.
I create a very deep (many levels) structure this way.

Your options are:

1) Change your data structure (I know you said you don't want to do that, but
you may have to anyway).

2) Implement a custorm representation within the serialisation framwork (as
Oliver has already suggested). Note that the essential problem is with your
datastructure, so you will still have to find a solution to the underlyng
problem -- perhaps by using an explicit stack rather than the Java thread's
stack.

3) Find/Implement a complete replacement for serialisation. Same caveat
applies as in (2), which makes it unlikely that an existing solution will work
for you without change.

4) Translate the structure into another form and serialise that. Similarly
rebuild your intended structure from the serialised from as you read it in.
This is roughly equivalent to (2) but may be easier to implement depending on
what you are doing.

5) Quit and find another job.

I.e. there are no easy answers -- you are going to have to do quite a lot of
work no matter how you approach it.

-- chris
 
Q

quetzalcotl

All,

I have the following Data Structure:
A HashMap that his value is a simple object or another HashMap that can
have as a value object or HashMap.
I create a very deep (many levels) structure this way.

Eventually I need to serialize this object. I get StackOverflow even if
I increase the thread stack size (-XX:ThreadStackSize) to his maximumx
size.

Note that this does NOT work for the initial thread. You may want to
let the serialization code run in a thread with a larger stack (which
you can specify on thread creation time, if I remember correctly.)

I am working with JDK1.5

It will be very difficult for me to change this data strcture.

Is there any tools that can help me to serialize such object without
changin my data structure ?

You may want to serialize a somewhat flattened data structure. For
example, a tree could be flattened to a list.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,142
Latest member
arinsharma
Top