On Tuesday, August 2, 2016 at 11:07:29 AM UTC-7, Erik Schnetter wrote:
>
> Can you make a copy of the vector, and assign this copy to the original
> variable? As in:
>
> ```Julia
> type Node
> edges::Vector{X}
> end
>
> ...
> node.edges = copy(node.edges)
> ...
> ```
>
> -erik
>
>
>
> On Tue, Aug 2, 2016 at 1:56 PM, Seth <[email protected] <javascript:>
> > wrote:
>
>>
>>
>> On Tuesday, August 2, 2016 at 10:41:26 AM UTC-7, Seth wrote:
>>>
>>> So, a 62.5 million edge LightGraphs.Graph should only take about a 1.25
>>> gigs of memory, all-in. However, because the edges are being added to
>>> vectors within the datastructure, and each vector is doing its own memory
>>> allocation, we wind up with the Julia process taking ~6.5 gigs.
>>>
>>> Given that we don't know the degree distribution of the graph before we
>>> load it (and therefore can't use sizehint! effectively), is there any way
>>> to reclaim the allocated-but-unused memory from all these vectors, with the
>>> accepted large performance hit that would come should we decide to add
>>> another edge?
>>>
>>
>> Things that I've tried that *don't* work:
>>
>> - explicitly calling sizehint! after the vectors have been created and
>> populated
>> - calling resize! after the vectors have been created and populated
>>
>>
>
>
>
>
Thanks. I tried this:
for i = 1:nv(g)
g.fadjlist[i] = copy(g.fadjlist[i])
end
and that actually increased memory footprint from 6.25 to 7.96 GB. I even
tried an explicit gc() afterwards.