igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] igraph_get_shortest_paths_dijkstra memory problem?


From: Daniel Schreiber
Subject: Re: [igraph] igraph_get_shortest_paths_dijkstra memory problem?
Date: Mon, 2 Mar 2009 16:58:00 -0600

thank you very much!!

2009/3/2 Gábor Csárdi <address@hidden>:
> Daniel,
>
> On Mon, Mar 2, 2009 at 11:16 PM, Daniel Schreiber
> <address@hidden> wrote:
> [...]
>>        //inititalize result:
>>        igraph_vector_ptr_t shortestPaths;
>>        igraph_vector_ptr_init(&shortestPaths,10);
>>        for(i=0; i<igraph_vcount(&g); i++) {
>
> You allocated 10 elements for 'shortestPaths' and then you assign 200
> (vcount) elements to it. This is causing the problem. 'VECTOR' does
> not do range checking, so it is hard to notice it. One possible way is
> to use 'valgrind'; that tells you where to look.
>
> So this line should be:
>
> for (i=0; i<10; i++) {
>
> Best,
> Gabor
>
>>            VECTOR(shortestPaths)[i] = calloc(1, sizeof(igraph_vector_t));
>>            igraph_vector_init(VECTOR(shortestPaths)[i], 0);
>>        }
>>
> [...]
>
> --
> Gabor Csardi <address@hidden>     UNIL DGM
>
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help
>
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]