Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Java
Out of memory with file streams
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Zig, post: 3483804"] Well, "reset" does reset the ObjectOutputStream back to the state it was initialized to: all objects are new, no class descriptors have been written, etc. Using reset() will decrease your memory overhead, but at the cost of increasing your data size (since the class descriptors have to be re-serialized). Weak / Soft references would be slick, but there is an extra "quirk" that would have to be addressed. reset() will put a RESET marker in the stream in order for ObjectInputStream to recognize that the stream has been reset (at which point it will dump it's references). Even while ObjectOutputStream could use soft references to determine that an object is no longer referenced, you also have to notify ObjectInputStream whent it's safe to clear it's references to objects that will not be subsequently re-referenced later in the stream. For simple objects you can get around all of this by using ObjectOutputStream.writeUnshared() / ObjectInputStream.readUnshared(), but those will still graph references for the nested object you'll get in a tree structure :/ Anyway, hope that was interesting food for thought, -Zig [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Java
Out of memory with file streams
Top