The data for vectors is always dynamically allocated. Only the bookkeeping data is stored on the stack. Even if it weren't, stack memory allocation is essentially free. Deallocating from the stack is just changing the value of a register on most architectures.
EDIT
Regarding the dynamic deallocation, it will have to be deallocated at one point or another (particularly the end of the function). You're not actually losing anything by leaving the memory allocated until you want to allocate more and there isn't enough. Is the precise timing of when that deallocation occurs really something to be concerned about before you actually run into some problem?
/EDIT
But what's the point? It really seems like you're prematurely concerning yourself with optimization.
If you want to refactor your code, do it for the sake of clarity, not performance.
vector<double> colsum
itself is not guaranteed to be reclaimed until the function exits, but its destructor is guaranteed to be called as soon as it leaves scope. – Jambeau