[Bioc-devel] ShortReadQ class and memory usage
mtmorgan at fredhutch.org
Mon Mar 30 19:09:10 CEST 2015
On 03/30/2015 09:04 AM, Mike Smith wrote:
> Hi all,
> I was wondering if anyone could explain the memory usage behaviour I see
> when subsetting a ShortReadQ object.
> If I create a ShortReadQ with 500 reads, each of length 200bp it uses
> ~230Kb of memory. If I do the same, but store 50,000 reads the memory
> usage goes up to ~21.5Mb - this seems entirely reasonable. However, if I
> then create a third object by subsetting the first 500 reads from the
> larger ShortReadQ it comes in at ~19.5Mb, which seems less understandable.
> I was hoping for some insight into why this might be.
It's actually inherited behavior from XStringSet -- the XStringSet is kind of
like a 'view' on a single larger object, subsetting the object creates a
different view but on the same large object. `compact()` actually realizes the
view as a new instance
> print(object.size(fq3), units = "auto") ## 19.6 Mb
> print(object.size(compact(fq3)), units = "auto")
> I've put some code in a Gist here that can run this example:
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109
Location: Arnold Building M1 B861
Phone: (206) 667-2793
More information about the Bioc-devel