Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: sort or reverted from version 51

Serialization of object on an output stream can extend the lifetime of objects, because the output stream keeps a reference to each serialized object, in its work at recognizing duplicate objects. Thus serializing a large set of objects prevents the objects from being garbage-collected.consequently preventing garbage collection of those objects. The ObjectOutputStream ensures that each object is written to the stream only once by retaining a reference (or handle) to each object written to the stream. When a previously written object is subsequently written to the stream again, it is replaced with a reference to the originally written data in the stream. Note that this substitution takes place without regard to whether the object's contents have changed in the interim. This table of references prevents garbage collection of the previously written objects because the garbage collector cannot collect live references.

This behavior is both desirable and correct While this behavior is desirable for data that potentially contains arbitrary object graphs, especially when the graphs are fully allocated and constructed prior to serialization. However, it can lead to memory exhaustion when serializing data that both lacks references to other objects being serialized and also can be allocated in part or in full after serialization has begun. One such example is serializing a data stream from an external sensor. In such cases, programs must take additional action to avoid memory exhaustion. That is, programs reading in independent serialized data must reset the object cache between reads to prevent memory exhaustion.

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="4f4fff59e1aae2ae-5edae188-42194992-813f8e1c-bcbc935e0ccc89136f61245d"><ac:plain-text-body><![CDATA[

[[API 2006

AA. Bibliography#API 06]]

 

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="bf60d39a3dba36b0-47bc596c-492b4ed0-8a98acaa-14c648875af253a40732eb9c"><ac:plain-text-body><![CDATA[

[[Harold 2006

AA. Bibliography#Harold 06]]

13.4. Performance

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="a4692d1073282150-3f6e8844-46724253-beb8b7de-f15259d1fbcf344518310efe"><ac:plain-text-body><![CDATA[

[[Sun 2006

AA. Bibliography#Sun 06]]

"Serialization specification"

]]></ac:plain-text-body></ac:structured-macro>

...