Boost logo

Boost Users :

Subject: Re: [Boost-users] A question about "prim_minimum_spanning_tree.hpp"
From: Gábor Szuromi (kukkerman_at_[hidden])
Date: 2010-08-27 12:00:48


Hi!

You're allocating edges and weights on the stack:

E edges[num_edges];
int weights[num_edges];

This is not a good idea, because stack space is very limited compared
to the heap. Allocate these two vectors on the heap instead:

E *edges = new E[num_edges];
int *weights = new int[num_edges];

....

delete[] edges;
delete[] weights;

Cheers,
  Gabe


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