I have RMI call

I pass a structure and the RMI method process it and access DB and fills the result in the same type of sturcture and returns. (code shown below)

when deserialization (readObject) i get a java.outofmemory: heap space..exception.

Hashmap object is big. I understand the the RMI does the objectOutputSteam.reset() automatically..

When the is bigger object involved how to handle the outofmemory excpetion.

Map<String, Object> mapObj = new HashMap<String, Object>();

mapObj = remoteObjectIF.callMethod(mapObj);

in the remote method it returns as shown below..

map<string, Object> callMethod(Map<string, Object> m_map){

map<string, Object> localmap;

fill m_map objects

localmap = m_map;

retrun localmap;

}