// a bunch of data, that is not destroyed until everything else here is out of scope int numEqs = //... int numVars = //... double *colLowerBounds = //... double *colUpperBounds = //... double *rowLowerBounds = //... double *rowUpperBounds = //... double *objective = //... CoinPackedMatrix matrix(false,0,0); matrix.setDimensions(0, numVars); for (int i = 0; i < numEqs; i++) // { CoinPackedVector row; //... add stuff to the row with several insert() calls here matrix.appendRow(row); } ClpSimplex model; model.loadProblem(matrix, colLowerBounds, colUpperBounds, objective, rowLowerBounds, rowUpperBounds); // here's the mysterious fix: model.writeMps(TempFileName,1); model.readMps(TempFileName); // end fix ClpSolve solve; model.initialSolve(solve); // crashes in here almost all the time without the mysterious fix, works 100% with it