From: Thomas F. <tho...@sp...> - 2013-03-29 11:14:02
|
Dear all We have experienced a "system.outofmemoryerror" with the latest version of dotnetrdf and the following code executed repeatedly (multiple times in a loop) against a Sesame server : Dim endpoint = New SparqlRemoteEndpoint(New Uri(" http://localhost:8080/sesame/repositories/my_repo")) Dim queryString As SparqlParameterizedString = New SparqlParameterizedString() queryString.Namespaces.AddNamespace("annot", New Uri(oAppSettingsReader.GetValue("BaseUriSite", GetType(System.String)) & "/annotations.owl#")) queryString.CommandText = "SELECT DISTINCT ?text WHERE {?annotation annot:onContent <" & _uriDocument & "> ; annot:onContentPart """ & ContentPart & """ ; annot:text ?text ; annot:isValid ""false""^^xsd:boolean . }" Dim results As SparqlResultSet = endpoint.QueryWithResultSet(queryString.ToString) For Each result As SparqlResult In results Console.WriteLine(DirectCast(result.Value("text"), LiteralNode).Value) Next results.Dispose() (note the use of "results.Dispose" that does not seem to have any effect on memory) That version of the code, however, works fine (no memory leak) : Dim store = New Storage.SesameHttpProtocolVersion6Connector(" http://localhost:8080/sesame/", "my_repo") Dim queryString As SparqlParameterizedString = New SparqlParameterizedString() queryString.Namespaces.AddNamespace("annot", New Uri(oAppSettingsReader.GetValue("BaseUriSite", GetType(System.String)) & "/annotations.owl#")) queryString.CommandText = "SELECT DISTINCT ?text WHERE {?annotation annot:onContent <" & _uriDocument & "> ; annot:onContentPart """ & ContentPart & """ ; annot:text ?text ; annot:isValid ""false""^^xsd:boolean . }" Dim results As [Object] = store.Query(queryString.ToString) For Each result As SparqlResult In DirectCast(results, SparqlResultSet) Console.WriteLine(DirectCast(result.Value("text"), LiteralNode).Value) Next Do you see anything wrong or missing in the first snippet above that could lead to a memory leak ? We are fairly new with DotNetRdf so we might have missed something - in that case would someone be kind enough to fix the first code snippet and send it back ? Or is it that Sesame server should not be queried with a SparqlRemoteEndpoint ? Thanks Thomas & Eric -- * * *Thomas Francart* - Sparna Consultant Indépendant Data, Sémantique, Contenus, Connaissances web : http://sparna.fr, blog : http://francart.fr Tel : +33 (0)6.71.11.25.97 Fax : +33 (0)9.58.16.17.14 Skype : francartthomas |