Hi Steve
I am not a Windows Phone expert so it is hard to tell what might be
happening.
Firstly how are you measuring the memory used? If you are using
GC.GetTotalMemory() then the GC has the option of invoking a garbage
collection when you call that method, if you've set the boolean parameter
to true it will wait for that collection before reporting memory used which
will eliminate any temporary objects that have yet to be collected. In
general I would expect the Windows Phone GC to be fairly proactive at
freeing up memory as obviously a phone has limited RAM.
If you aren't already you should try using the Windows Phone 7 memory usage
metrics, see
http://blogs.msdn.com/b/mikeormond/archive/2010/12/16/monitoring-memory-usag
e-on-windows-phone-7.aspx for a nice blog post on this.
In terms of memory usage for the result set this may be very small
depending on the size of your results and the values involved. Typically a
triple takes around 1 KB (assuming you don't have really long literals) so
an individual node takes about 300 bytes or so. So say you had 10 results
with 3 values for each result you'd only use about 10 KB of memory
(possibly less depending on the exact values). If your results set has
fewer columns or all the values are very short then this memory usage may
be far less.
A SparqlResultSet has minimal memory overhead since internally it is a
couple of lists and similarly an individual SparqlResult is internally a
small dictionary.
In contrast IGraph implementations typically exhibit much higher memory
overhead because they incorporate indexes on the triples. For example the
default Graph implementation which is fully indexed takes ~1.7 KB per
triple on average as opposed to a non-indexed implementation like
NonIndexedGraph which requires only ~1 KB per triple (i.e. there is an
extra 0.7 KB per triple for indexing)
Also your memory usage may be affected by temporary objects, so if you
created a SparqlRemoteEndpoint instance local to a method in order to make
the query and check the initial memory usage in that method then that
object would be out of scope and potentially GCd by the time you check the
final memory usage.
Hope that helps,
Rob
----------------------------------------
From: "Steve S" <s....@li...>
Sent: 05 September 2011 18:56
To: "Rob Vesse" <rv...@do...>
Subject: RE: [dotNetRDF-Develop] WP7 Memory Usage
Hi Rob,
I am trying to get the memory usage of Windows Phone 7 when getting a
response from sparql endpoint via HTTP using dotNetRdf for Windows Phone 7.
I am calculating the memory used before the request is sent and then just
after receiving the reply (in the ResultsCallBack method). I was expecting
the second memory calculation to be higher than the first, but instead it
is either the same or lower than the first reading. Is that normal for WP7
or is this because of the asynchronous callback or am I doing something
wrong?
Regards,
Steve
|