Hello Raniere, the documentation in glpk-4.47\doc\glpk.pdf describes that function glp_mat_get_col may return 1 + number of rows values.
You allocate memory for 1 + number of integer columns values. Use function glp_get_num_rows to retrieve the number of rows. Do not forget to delete the problem with glpk_delete_prob. Best regards Xypron -------- Original-Nachricht -------- > Datum: Thu, 10 Nov 2011 21:08:00 -0200 > Betreff: [Help-glpk] Memory Corruption inside glp_simplex > Hello, > I'm trying to implement a heuristic for a MIP and need to get some > informations about the problem and use the function glp_simplex several > times. > Unfortunately when I call glp_simplex after call glp_get_mat_col I get a > memory curruption erro. > > Below I paste part of the erro get when I run the attached files of a > minimal file. > > $ ./test exemp01.mps > Reading problem data from `exemp01.mps'... > Problem: exemp03 > Objective: z > 3 rows, 2 columns, 6 non-zeros > 2 integer variables, none of which are binary > 25 records were read > GLPK Simplex Optimizer, v4.47 > 3 rows, 2 columns, 6 non-zeros > * 0: obj = 0.000000000e+00 infeas = 0.000e+00 (0) > * 2: obj = -1.055555556e+02 infeas = 0.000e+00 (0) > OPTIMAL SOLUTION FOUND > GLPK Simplex Optimizer, v4.47 > 3 rows, 2 columns, 6 non-zeros > *** glibc detected *** ./test: malloc(): memory corruption: > 0x0000000000ac9f10 *** > ======= Backtrace: ========= > /lib/x86_64-linux-gnu/libc.so.6(+0x79d7a)[0x7fc52edfcd7a] > /lib/x86_64-linux-gnu/libc.so.6(__libc_malloc+0x6e)[0x7fc52edff31e] > /usr/local/lib/libglpk.so.0(glp_malloc+0x8d)[0x7fc52f14592d] > /usr/local/lib/libglpk.so.0(+0x948e8)[0x7fc52f1ab8e8] > /usr/local/lib/libglpk.so.0(glp_simplex+0x75b)[0x7fc52f123d7b] > ./test[0x400892] > /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xff)[0x7fc52eda1eff] > ./test[0x4006a9] > > Thanks, > Raniere Gaia Costa da Silva -- Follow me at http://twitter.com/#!/xypron Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de _______________________________________________ Help-glpk mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-glpk
