|
Boost Users : |
From: David Brumley (dbrumley_at_[hidden])
Date: 2006-02-13 16:56:04
Hi,
I'm switching from a home-grown graph library to BGL (for creating
control flow graphs and callgraphs of program binaries). I must not be
using BGL correctly because I keep running out of memory (I'm running
FC4 with 1GB). For example, given the following simple program:
int main(int argc, char *argv[])
{
// create a typedef for the Graph type
typedef adjacency_list<vecS, vecS, bidirectionalS> Graph;
unsigned int *array;
array = new unsigned int[50];
unsigned int i;
for(i = 0; i < 50; i++){
array[i] = i + 0x8000000;
}
// writing out the edges in the graph
Graph g;
for(i = 0; i < 50; i++){
add_edge(array[i % 50], array[ (i+1) % 50], g);
}
}
And the error I get is:
[dbrumley_at_localhost ~/tmp]$ ./a.out
terminate called after throwing an instance of 'std::bad_alloc'
what(): St9bad_alloc
Abort
which is caused by new/new[] throwing an exception on the add_edge
line.
What am I doing wrong here? I would like to index each node in the graph
by its address, which is in the range 0x8000000-0xffffffff. (I would
rather not keep a separate index in the range 0-num(verticies)).
Thanks,
David
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net