==4107075== Memcheck, a memory error detector ==4107075== Copyright (C) 2002-2026, and GNU GPL'd, by Julian Seward et al. ==4107075== Using Valgrind-3.27.1 and LibVEX; rerun with -h for copyright info ==4107075== Command: /data/localhost/ripley/R/R-devel-vg/bin/exec/R -f test-compat-clpAPI.R --restore --save --no-readline --vanilla ==4107075== R Under development (unstable) (2026-09-15 r90540) -- "Unsuffered Consequences" Copyright (C) 2026 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > ## The clpAPI compatibility layer, exercised the way existing code uses it. > > library(coinclp) > > near <- function(x, y, tol = 1e-6) all(abs(x - y) < tol) > > stopifnot(is.character(versionCLP()), nzchar(versionCLP())) > > lp <- initProbCLP() > stopifnot(isCLPpointer(lp), !isNULLpointerCLP(lp), + identical(clpPtrType(lp), "clp_prob"), + typeof(clpPointer(lp)) == "externalptr") > clpPtrType(lp) <- "renamed" > stopifnot(identical(clpPtrType(lp), "renamed")) > > ## This is the sequence ROI.plugin.clp used. > setLogLevelCLP(lp, 0) > loadProblemCLP(lp, 2, 3, c(0, 3, 6), c(0, 1, 2, 0, 1, 2), + c(120, 110, 1, 210, 30, 1), + lb = c(0, 0), ub = c(1e30, 1e30), obj_coef = c(143, 60), + rlb = rep(-1e30, 3), rub = c(15000, 4000, 75)) > setObjDirCLP(lp, -1) > setMaximumIterationsCLP(lp, 1000) > setMaximumSecondsCLP(lp, 60) > stopifnot(solveInitialCLP(lp) == 0) > > stopifnot(getSolStatusCLP(lp) == 0, + status_codeCLP(getSolStatusCLP(lp)) == "solution is optimal", + return_codeCLP(0) == "solution process was successful", + near(getObjValCLP(lp), 6315.625), + near(getColPrimCLP(lp), c(21.875, 53.125)), + length(getRowDualCLP(lp)) == 3, + length(getColDualCLP(lp)) == 2, + near(getRowPrimCLP(lp), c(13781.25, 4000, 75))) > > stopifnot(getNumRowsCLP(lp) == 3, getNumColsCLP(lp) == 2, + getNumNnzCLP(lp) == 6, + near(getObjCoefsCLP(lp), c(143, 60)), + near(getRowUpperCLP(lp), c(15000, 4000, 75)), + near(getColLowerCLP(lp), c(0, 0)), + length(getVecStartCLP(lp)) == 3, + length(getIndCLP(lp)) == 6, + length(getNnzCLP(lp)) == 6, + length(getVecLenCLP(lp)) == 2, + getObjDirCLP(lp) == -1, + getLogLevelCLP(lp) == 0, + getMaximumIterationsCLP(lp) == 1000, + getMaximumSecondsCLP(lp) >= 60, + is.logical(getHitMaximumIterationsCLP(lp))) > > chgObjCoefsCLP(lp, c(1, 1)) > stopifnot(near(getObjCoefsCLP(lp), c(1, 1))) > chgColUpperCLP(lp, c(10, 10)) > stopifnot(near(getColUpperCLP(lp), c(10, 10))) > chgRowLowerCLP(lp, rep(-1e30, 3)) > chgRowUpperCLP(lp, c(15000, 4000, 60)) > stopifnot(near(getRowUpperCLP(lp), c(15000, 4000, 60))) > chgColLowerCLP(lp, c(0, 0)) > > ## Names and scaling. > copyNamesCLP(lp, c("x", "y"), c("mix", "time", "capacity")) > stopifnot(lengthNamesCLP(lp) >= 8) > probNameCLP(lp, "compat") > scaleModelCLP(lp, 1) > stopifnot(getScaleFlagCLP(lp) == 1) > dropNamesCLP(lp) > > ## The other solve entry points. > setObjDirCLP(lp, 1) > stopifnot(is.numeric(solveInitialDualCLP(lp)) || is.integer(solveInitialDualCLP(lp))) > primalCLP(lp) [1] 0 > dualCLP(lp, 0) [1] 0 > idiotCLP(lp, 0) > > ## Structural edits. > addRowsCLP(lp, 1, -1e30, 30, c(0, 2), c(0, 1), c(1, 1)) > stopifnot(getNumRowsCLP(lp) == 4) > delRowsCLP(lp, 1, 3) > stopifnot(getNumRowsCLP(lp) == 3) > addColsCLP(lp, 1, 0, 1e30, 1, c(0, 1), 0, 1) > stopifnot(getNumColsCLP(lp) == 3) > delColsCLP(lp, 1, 2) > stopifnot(getNumColsCLP(lp) == 2) > resizeCLP(lp, 3, 2) > > ## Optional entry points report availability rather than failing obscurely. > available <- isAvailableFuncCLP("Clp_writeMps") > stopifnot(is.logical(available), length(available) == 1L) > stopifnot(identical(unname(isAvailableFuncCLP("no_such_function")), FALSE)) > > ## Save and restore round trip. > snapshot <- tempfile() > stopifnot(saveModelCLP(lp, snapshot) == 0) ==4107075== Syscall param write(buf) points to uninitialised byte(s) ==4107075== at 0x5746F7D: write (/usr/src/debug/glibc-2.43-8.fc44.x86_64/io/../sysdeps/unix/sysv/linux/write.c:26) ==4107075== by 0x56C7E3C: _IO_file_write@@GLIBC_2.2.5 (/usr/src/debug/glibc-2.43-8.fc44.x86_64/libio/fileops.c:1241) ==4107075== by 0x56C5BB5: new_do_write (/usr/src/debug/glibc-2.43-8.fc44.x86_64/libio/fileops.c:483) ==4107075== by 0x56C6D10: _IO_do_write@@GLIBC_2.2.5 (/usr/src/debug/glibc-2.43-8.fc44.x86_64/libio/fileops.c:460) ==4107075== by 0x56C63EF: _IO_file_close_it@@GLIBC_2.2.5 (/usr/src/debug/glibc-2.43-8.fc44.x86_64/libio/fileops.c:136) ==4107075== by 0x56B9224: fclose@@GLIBC_2.2.5 (/usr/src/debug/glibc-2.43-8.fc44.x86_64/libio/iofclose.c:53) ==4107075== by 0x1114ED21: ClpSimplex::saveModel(char const*) (/usr/src/debug/coin-or-Clp-1.17.10-11.fc44.x86_64/Clp/src/ClpSimplex.cpp:6994) ==4107075== by 0xFF0A8B3: coinclp_save_model (/data/localhost/ripley/R/packages/tests-vg/coinclp/src/coinclp_io.cpp:201) ==4107075== by 0x496E69: R_doDotCall (/data/localhost/ripley/R/svn/R-devel/src/main/dotcode.c:757) ==4107075== by 0x4D4C9A: bcEval_loop (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:8704) ==4107075== Address 0x97d1ebc is 204 bytes inside a block of size 4,096 alloc'd ==4107075== at 0x4841AE6: malloc (/builddir/build/BUILD/valgrind-3.27.1-build/valgrind-3.27.1/coregrind/m_replacemalloc/vg_replace_malloc.c:447) ==4107075== by 0x56B8F42: _IO_file_doallocate (/usr/src/debug/glibc-2.43-8.fc44.x86_64/libio/filedoalloc.c:91) ==4107075== by 0x56C94B5: _IO_doallocbuf (/usr/src/debug/glibc-2.43-8.fc44.x86_64/libio/genops.c:373) ==4107075== by 0x56C94B5: _IO_doallocbuf (/usr/src/debug/glibc-2.43-8.fc44.x86_64/libio/genops.c:368) ==4107075== by 0x56C72B8: _IO_file_overflow@@GLIBC_2.2.5 (/usr/src/debug/glibc-2.43-8.fc44.x86_64/libio/fileops.c:779) ==4107075== by 0x56C7F87: _IO_new_file_xsputn (/usr/src/debug/glibc-2.43-8.fc44.x86_64/libio/fileops.c:1305) ==4107075== by 0x56C7F87: _IO_file_xsputn@@GLIBC_2.2.5 (/usr/src/debug/glibc-2.43-8.fc44.x86_64/libio/fileops.c:1258) ==4107075== by 0x56BA7DA: fwrite (/usr/src/debug/glibc-2.43-8.fc44.x86_64/libio/iofwrite.c:44) ==4107075== by 0x1114E8CF: ClpSimplex::saveModel(char const*) (/usr/src/debug/coin-or-Clp-1.17.10-11.fc44.x86_64/Clp/src/ClpSimplex.cpp:6860) ==4107075== by 0xFF0A8B3: coinclp_save_model (/data/localhost/ripley/R/packages/tests-vg/coinclp/src/coinclp_io.cpp:201) ==4107075== by 0x496E69: R_doDotCall (/data/localhost/ripley/R/svn/R-devel/src/main/dotcode.c:757) ==4107075== by 0x4D4C9A: bcEval_loop (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:8704) ==4107075== by 0x4E4141: bcEval (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:7533) ==4107075== by 0x4E4141: bcEval (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:7518) ==4107075== by 0x4E450A: Rf_eval (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:1167) ==4107075== Uninitialised value was created by a stack allocation ==4107075== at 0xFF09470: ??? (in /data/localhost/ripley/R/packages/tests-vg/coinclp.Rcheck/coinclp/libs/coinclp.so) ==4107075== > stopifnot(restoreModelCLP(lp, snapshot) == 0) > unlink(snapshot) > > ## Writing MPS works whichever entry point is available. > mps <- tempfile(fileext = ".mps") > writeMPSCLP(lp, mps) > stopifnot(file.exists(mps), length(readLines(mps)) > 3) > unlink(mps) > > delProbCLP(lp) > stopifnot(isNULLpointerCLP(lp)) > > proc.time() user system elapsed 24.669 0.969 21.826 ==4107075== ==4107075== HEAP SUMMARY: ==4107075== in use at exit: 58,391,317 bytes in 17,081 blocks ==4107075== total heap usage: 36,237 allocs, 19,156 frees, 102,181,529 bytes allocated ==4107075== ==4107075== LEAK SUMMARY: ==4107075== definitely lost: 0 bytes in 0 blocks ==4107075== indirectly lost: 0 bytes in 0 blocks ==4107075== possibly lost: 0 bytes in 0 blocks ==4107075== still reachable: 58,391,317 bytes in 17,081 blocks ==4107075== suppressed: 0 bytes in 0 blocks ==4107075== Reachable blocks (those to which a pointer was found) are not shown. ==4107075== To see them, rerun with: --leak-check=full --show-leak-kinds=all ==4107075== ==4107075== For lists of detected and suppressed errors, rerun with: -s ==4107075== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)