public void SparqlRemoteEndpointMemoryLeak1() { /* * 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() */ //Do a GC before attempting the test GC.GetTotalMemory(true); //First off make sure to load some data into the some SparqlRemoteUpdateEndpoint updateEndpoint = RemoteEndpoints.GetUpdateEndpoint(); updateEndpoint.Update("DROP ALL; INSERT DATA { <http://subject> <http://predicate> <http://object> . }"); int totalRuns = 10000; //Loop over making queries to try and reproduce the memory leak for (int i = 1; i <= totalRuns; i++) { SparqlRemoteEndpoint endpoint = RemoteEndpoints.GetQueryEndpoint(); SparqlParameterizedString queryString = new SparqlParameterizedString(); queryString.CommandText = "SELECT * WHERE { ?s ?p ?o }"; SparqlResultSet results = endpoint.QueryWithResultSet(queryString.ToString()); Assert.Equal(1, results.Count); foreach (SparqlResult result in results) { //We're just iterating to make sure we touch the whole of the results } results.Dispose(); if (i % 500 == 0) { Debug.WriteLine("Memory Usage after " + i + " Iterations: " + Process.GetCurrentProcess().PrivateMemorySize64); } } Debug.WriteLine("Memory Usage after " + totalRuns + " Iterations: " + Process.GetCurrentProcess().PrivateMemorySize64); }