igraph-help
[Top][All Lists]
Advanced

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

[igraph] Memory management of igraph_vector_t in C


From: Hadidi, Lars
Subject: [igraph] Memory management of igraph_vector_t in C
Date: Wed, 9 Sep 2015 17:53:33 +0000

When using the igraph_vector_t type, it needs to be initialized with the function igraph_vector_init​, which takes the amount of elements to be initialized as an argument. The documentation says, that the size of vectors will be handles automatically by increasing their size on demand, but not using free when they decrease, in order to keep performance. Therefore, some internal management must be done. My question is, if it is possible to overestimate the size of the vector on initialization and assigning elements less then the initialization size ? Will the internal management keep track of that, and will the algorithms perform correctly on such vectors. I try to avoid memory allocation inside the main loop of my program.​


reply via email to

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