Author: reto
Date: Thu Jan 20 19:42:02 2011
New Revision: 1061476

URL: http://svn.apache.org/viewvc?rev=1061476&view=rev
Log:
CLEREZZA-384: application to reproduce memory issues, run with 
MAVEN_OPTS="-Xmx256m -Xms128m"  mvn clean install exec:java -o -e

Added:
    incubator/clerezza/issues/CLEREZZA-384/
    incubator/clerezza/issues/CLEREZZA-384/turtlememory/   (with props)
    incubator/clerezza/issues/CLEREZZA-384/turtlememory/pom.xml
    incubator/clerezza/issues/CLEREZZA-384/turtlememory/src/
    incubator/clerezza/issues/CLEREZZA-384/turtlememory/src/main/
    incubator/clerezza/issues/CLEREZZA-384/turtlememory/src/main/java/
    incubator/clerezza/issues/CLEREZZA-384/turtlememory/src/main/java/test/
    
incubator/clerezza/issues/CLEREZZA-384/turtlememory/src/main/java/test/turtle/
    
incubator/clerezza/issues/CLEREZZA-384/turtlememory/src/main/java/test/turtle/JenaParserProvider.java
    
incubator/clerezza/issues/CLEREZZA-384/turtlememory/src/main/java/test/turtle/TestWithFiles.java
    incubator/clerezza/issues/CLEREZZA-384/turtlememory/src/main/resources/
    incubator/clerezza/issues/CLEREZZA-384/turtlememory/src/main/resources/test/
    
incubator/clerezza/issues/CLEREZZA-384/turtlememory/src/main/resources/test/turtle/
    
incubator/clerezza/issues/CLEREZZA-384/turtlememory/src/main/resources/test/turtle/test1.ttl
    
incubator/clerezza/issues/CLEREZZA-384/turtlememory/src/main/resources/test/turtle/test2.ttl
    
incubator/clerezza/issues/CLEREZZA-384/turtlememory/src/main/resources/test/turtle/test3.ttl
    
incubator/clerezza/issues/CLEREZZA-384/turtlememory/src/main/resources/test/turtle/test4.ttl
    
incubator/clerezza/issues/CLEREZZA-384/turtlememory/src/main/resources/test/turtle/test5.ttl
    
incubator/clerezza/issues/CLEREZZA-384/turtlememory/src/main/resources/test/turtle/test6.ttl
    
incubator/clerezza/issues/CLEREZZA-384/turtlememory/src/main/resources/test/turtle/test7.ttl
    
incubator/clerezza/issues/CLEREZZA-384/turtlememory/src/main/resources/test/turtle/test8.ttl
    
incubator/clerezza/issues/CLEREZZA-384/turtlememory/src/main/resources/test/turtle/test9.ttl
    incubator/clerezza/issues/CLEREZZA-384/turtlememory/src/test/
    incubator/clerezza/issues/CLEREZZA-384/turtlememory/src/test/java/
    incubator/clerezza/issues/CLEREZZA-384/turtlememory/src/test/resources/

Propchange: incubator/clerezza/issues/CLEREZZA-384/turtlememory/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jan 20 19:42:02 2011
@@ -0,0 +1 @@
+target

Added: incubator/clerezza/issues/CLEREZZA-384/turtlememory/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-384/turtlememory/pom.xml?rev=1061476&view=auto
==============================================================================
--- incubator/clerezza/issues/CLEREZZA-384/turtlememory/pom.xml (added)
+++ incubator/clerezza/issues/CLEREZZA-384/turtlememory/pom.xml Thu Jan 20 
19:42:02 2011
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><project 
xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
+       <modelVersion>4.0.0</modelVersion>
+       <parent>
+               <artifactId>org.apache.clerezza.parent</artifactId>
+               <groupId>org.apache.clerezza</groupId>
+               <version>0.2-incubating-SNAPSHOT</version>
+       </parent>
+       <groupId>org.apache.clerezza</groupId>
+       <artifactId>turtlememory</artifactId>
+       <packaging>bundle</packaging>
+       <version>0.10-incubating-SNAPSHOT</version>
+       <dependencies>
+               <dependency>
+                       <groupId>junit</groupId>
+                       <artifactId>junit</artifactId>
+                       <scope>test</scope>
+               </dependency>
+               <dependency>
+                       <groupId>com.hp.hpl.jena</groupId>
+                       <artifactId>jena</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.slf4j</groupId>
+                       <artifactId>slf4j-simple</artifactId>
+                       <!-- <scope>runtime</scope> -->
+               </dependency>
+       </dependencies>
+       <build>
+               <plugins>       
+                       <plugin>
+                               <groupId>org.apache.felix</groupId>
+                               <artifactId>maven-bundle-plugin</artifactId>
+                               <extensions>true</extensions>
+                               <configuration>
+                                       <instructions>                  
+                                               <Include-Resource>
+                                                       {maven-resources}
+                                               </Include-Resource>
+                                       </instructions>
+                               </configuration>
+                       </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>exec-maven-plugin</artifactId>
+        <version>1.2</version>
+        <configuration>
+          <!-- <mainClass>test.turtle.JenaParserProvider</mainClass> -->
+                 <mainClass>test.turtle.TestWithFiles</mainClass>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
\ No newline at end of file

Added: 
incubator/clerezza/issues/CLEREZZA-384/turtlememory/src/main/java/test/turtle/JenaParserProvider.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-384/turtlememory/src/main/java/test/turtle/JenaParserProvider.java?rev=1061476&view=auto
==============================================================================
--- 
incubator/clerezza/issues/CLEREZZA-384/turtlememory/src/main/java/test/turtle/JenaParserProvider.java
 (added)
+++ 
incubator/clerezza/issues/CLEREZZA-384/turtlememory/src/main/java/test/turtle/JenaParserProvider.java
 Thu Jan 20 19:42:02 2011
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package test.turtle;
+
+
+
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.ModelFactory;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.util.Date;
+
+public class JenaParserProvider  {
+
+       private static void parse(InputStream in) {
+               System.out.println("parsing");
+               String jenaFormat = "TURTLE";
+               Model model = ModelFactory.createDefaultModel();
+               model.read(in, "http://ex.org";, jenaFormat);
+
+       }
+
+       private static InputStream getTurtleSource() throws 
UnsupportedEncodingException {
+               String turtleString = getTurtleString();
+               return new ByteArrayInputStream(turtleString.getBytes("utf-8"));
+       }
+
+       public static void main(String... args) throws 
UnsupportedEncodingException {
+               for (int i = 0; i < 10000; i++) {
+                       parse(getTurtleSource());
+                       System.out.println(new Date()+ " 
"+Runtime.getRuntime().freeMemory());
+               }
+       }
+
+       private static String getTurtleString() {
+               return "@prefix e: <http://ex.org/foo> .\n"+
+                               "@prefix rdf: 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n"+
+               "e:test rdf:value  \""+randomString(45640)+"\"."+
+                               "[ rdf:value  \""+randomString(45640)+"\";"+
+                               " e:p  \""+randomString(45640)+"\"].";
+       }
+
+       private static String randomString(long length) {
+               StringBuilder resultBuffer = new StringBuilder();
+               for (long i = 0; i < length; i++) {
+                       resultBuffer.append((char)Math.random()*200);
+               }
+               return resultBuffer.toString();
+       }
+
+}

Added: 
incubator/clerezza/issues/CLEREZZA-384/turtlememory/src/main/java/test/turtle/TestWithFiles.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-384/turtlememory/src/main/java/test/turtle/TestWithFiles.java?rev=1061476&view=auto
==============================================================================
--- 
incubator/clerezza/issues/CLEREZZA-384/turtlememory/src/main/java/test/turtle/TestWithFiles.java
 (added)
+++ 
incubator/clerezza/issues/CLEREZZA-384/turtlememory/src/main/java/test/turtle/TestWithFiles.java
 Thu Jan 20 19:42:02 2011
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package test.turtle;
+
+
+
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.ModelFactory;
+import java.io.File;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+public class TestWithFiles  {
+
+       private static void parse(String url) {
+               System.out.println("parsing: "+url);
+               String jenaFormat = "TURTLE";
+               Model model = ModelFactory.createDefaultModel();
+               model.read(url, jenaFormat);
+
+       }
+
+       public static void main(String... args) {
+               parse(TestWithFiles.class.getResource("test6.ttl").toString());
+               System.out.println(new Date()+ " 
"+Runtime.getRuntime().freeMemory());
+               for (int j = 0; j < 100; j++) {
+                       for (int i = 9; i > 0; i--) {
+                               String url = 
TestWithFiles.class.getResource("test"+i+".ttl").toString();
+                               parse(url.toString());
+                               System.out.println(new Date()+ " 
"+Runtime.getRuntime().freeMemory());
+                       }
+               }
+       }
+
+}


Reply via email to