UcasRichard / snakeyaml

Automatically exported from code.google.com/p/snakeyaml
Apache License 2.0
0 stars 0 forks source link

out of memory on deserialize #101

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. deserialize large yml file 401kb with complex structures (inner lists)
2.
3.

What is the expected output? What do you see instead?
no out of memory for 401kb file

What version of the product are you using? On what operating system?
1.7 (from maven repository) on Mac OS X 10.6.6

Please provide any additional information below.
1.7 from maven repository produce this stack when I load my test file:
Exception in thread "Thread-3" java.lang.OutOfMemoryError: Java heap space
    at java.util.Arrays.copyOfRange(Arrays.java:3209)
    at java.lang.String.<init>(String.java:215)
    at java.lang.StringBuilder.toString(StringBuilder.java:430)
    at org.yaml.snakeyaml.reader.StreamReader.getMark(StreamReader.java:74)
    at org.yaml.snakeyaml.scanner.ScannerImpl.scanPlain(ScannerImpl.java:1593)
    at org.yaml.snakeyaml.scanner.ScannerImpl.fetchPlain(ScannerImpl.java:860)
    at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:348)
    at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:183)
    at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingKey.produce(ParserImpl.java:564)
    at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:163)
    at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:148)
    at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:228)
    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:160)
    at org.yaml.snakeyaml.composer.Composer.composeSequenceNode(Composer.java:204)
    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:158)
    at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:230)
    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:160)
    at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:230)
    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:160)
    at org.yaml.snakeyaml.composer.Composer.composeSequenceNode(Composer.java:204)
    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:158)
    at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:230)
    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:160)
    at org.yaml.snakeyaml.composer.Composer.composeSequenceNode(Composer.java:204)
    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:158)
    at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:230)
    at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:160)
    at org.yaml.snakeyaml.composer.Composer.composeDocument(Composer.java:122)
    at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:105)
    at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:124)
    at org.yaml.snakeyaml.Yaml.load(Yaml.java:264)
    at it.bpe.app.serialize.ProjectSerializerYml.deserializeProjectInfoFromFile(ProjectSerializerYml.java:67)

BUT IF I CHECKOUT 1.7 VERSION FROM CODE.GOOGLE.COM AND I USE IT AFTER 
COMPILATION, I HAVEN'T OUT OF MEMORY PROBLEM:

What steps will NOT reproduce the problem?
1. checkout 1.7 version from code.google
2. change pom.xml of snakeyaml with version 1.8-snapshot
3. recompile snakeyaml
3. change pom.xml of my application to point to snakeyaml 1.8-snapshot
4. recompile my app
5. relaunch my app

THANKS IN ADVANCE

Original issue reported on code.google.com by antonio....@gmail.com on 10 Jan 2011 at 12:23

GoogleCodeExporter commented 9 years ago
Do you mean you specified the 1.7 tag when you cloned the source ? Can you 
please attach the diff (hg diff)?

Original comment by py4fun@gmail.com on 10 Jan 2011 at 12:49

GoogleCodeExporter commented 9 years ago
I did this steps:

1) hg clone https://snakeyaml.googlecode.com/hg/ snakeyaml (after clone in 
pom.xml the version is 1.8-SNAPSHOT)
2) launch mvn clean install
3) change my pom.xml:
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.8-SNAPSHOT</version>
</dependency>

4) relaunch my app
5) deserialize my large file with no problems

hg diff doesn't produce any text

if I change my pom.xml dependency:
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.7</version>
</dependency>

I have out of memory loading my large yml file 

Does the version 1.7 on http://repo2.maven.org/maven2/org/yaml/snakeyaml differ 
from I cloned from https://snakeyaml.googlecode.com/hg/

I don't known how I can help further so if you have any questions write well

Original comment by antonio....@gmail.com on 10 Jan 2011 at 1:42

GoogleCodeExporter commented 9 years ago
I did this steps:

1) hg clone https://snakeyaml.googlecode.com/hg/ snakeyaml (after clone in 
pom.xml the version is 1.8-SNAPSHOT)
2) launch mvn clean install
3) change my pom.xml:
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.8-SNAPSHOT</version>
</dependency>

4) relaunch my app
5) deserialize my large file with no problems

hg diff doesn't produce any text

if I change my pom.xml dependency:
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.7</version>
</dependency>

I have out of memory loading my large yml file 

Does the version 1.7 on http://repo2.maven.org/maven2/org/yaml/snakeyaml differ 
from I cloned from https://snakeyaml.googlecode.com/hg/

I don't known how I can help further so if you have any questions write well

Original comment by antonio....@gmail.com on 10 Jan 2011 at 1:43

GoogleCodeExporter commented 9 years ago
Now it is clear. In the very first post you said:
1. checkout 1.7 version from code.google
while in fact it is not 1.7 version but the latest trunk. 
Here http://code.google.com/p/snakeyaml/wiki/changes you may see that issue 79 
(http://code.google.com/p/snakeyaml/issues/detail?id=79) has been fixed.

You may use the latest SNAPSHOT 
(http://code.google.com/p/snakeyaml/wiki/readme) or wait for the 1.8 release

Original comment by py4fun@gmail.com on 10 Jan 2011 at 1:54