I downloaded the open source package ipopt and then modify simple example to fit with my problem. And errors happens. glibc detected ./cpp_example: munmap_chunk(): invalid pointer: 0x00007f9227c05010 * ======= Backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x7db26)[0x7f92291c5b26] /opt/ipopt/Ipopt-3.11.9/lib/libipopt.so.1(_ZN5Ipopt11TNLPAdapter9GetSpacesERNS_8SmartPtrIKNS_11VectorSpaceEEES5_S5_S5_RNS1_IKNS_11MatrixSpaceEEES5_S9_S5_S9_S5_S9_S9_S9_RNS1_IKNS_14SymMatrixSpaceEEE+0x58c2)[0x7f922c956572] /opt/ipopt/Ipopt-3.11.9/lib/libipopt.so.1(_ZN5Ipopt12OrigIpoptNLP20InitializeStructuresERNS_8SmartPtrINS_6VectorEEEbS4_bS4_bS4_bS4_bS4_S4_+0x5b1)[0x7f922c9f1b01] /opt/ipopt/Ipopt-3.11.9/lib/libipopt.so.1(_ZN5Ipopt9IpoptData24InitializeDataStructuresERNS_8IpoptNLPEbbbbb+0xe4)[0x7f922c9cc524] /opt/ipopt/Ipopt-3.11.9/lib/libipopt.so.1(_ZN5Ipopt25DefaultIterateInitializer18SetInitialIteratesEv+0x3f)[0x7f922c994f2f] /opt/ipopt/Ipopt-3.11.9/lib/libipopt.so.1(_ZN5Ipopt14IpoptAlgorithm18InitializeIteratesEv+0xf)[0x7f922c9a666f] /opt/ipopt/Ipopt-3.11.9/lib/libipopt.so.1(_ZN5Ipopt14IpoptAlgorithm8OptimizeEb+0xa6)[0x7f922c9aab96] /opt/ipopt/Ipopt-3.11.9/lib/libipopt.so.1(_ZN5Ipopt16IpoptApplication13call_optimizeEv+0x444)[0x7f922c93bbb4] /opt/ipopt/Ipopt-3.11.9/lib/libipopt.so.1(_ZN5Ipopt16IpoptApplication11OptimizeNLPERKNS_8SmartPtrINS_3NLPEEERNS1_INS_16AlgorithmBuilderEEE+0x14d)[0x7f922c93f95d] /opt/ipopt/Ipopt-3.11.9/lib/libipopt.so.1(_ZN5Ipopt16IpoptApplication11OptimizeNLPERKNS_8SmartPtrINS_3NLPEEE+0x18)[0x7f922c940908] /opt/ipopt/Ipopt-3.11.9/lib/libipopt.so.1(_ZN5Ipopt16IpoptApplication12OptimizeTNLPERKNS_8SmartPtrINS_4TNLPEEE+0xca)[0x7f922c93b71a] ./cpp_example[0x40242e] /lib/x86_64-linux-gnu/libc.so.6(libc_start_main+0xed)[0x7f922916976d] ./cpp_example[0x402951]
I just declare 6 pointers, 4 pointers to take input 4 data variables, and 2 pointers to save data after generating. But when i run the code, there are some errors. /------------------ Memory Allocation /------------------ 1d arrays
Moved from TRAC as part of COIN fORgery:
I downloaded the open source package ipopt and then modify simple example to fit with my problem. And errors happens. glibc detected
./cpp_example: munmap_chunk(): invalid pointer: 0x00007f9227c05010 * ======= Backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x7db26)[0x7f92291c5b26] /opt/ipopt/Ipopt-3.11.9/lib/libipopt.so.1(_ZN5Ipopt11TNLPAdapter9GetSpacesERNS_8SmartPtrIKNS_11VectorSpaceEEES5_S5_S5_RNS1_IKNS_11MatrixSpaceEEES5_S9_S5_S9_S5_S9_S9_S9_RNS1_IKNS_14SymMatrixSpaceEEE+0x58c2)[0x7f922c956572] /opt/ipopt/Ipopt-3.11.9/lib/libipopt.so.1(_ZN5Ipopt12OrigIpoptNLP20InitializeStructuresERNS_8SmartPtrINS_6VectorEEEbS4_bS4_bS4_bS4_bS4_S4_+0x5b1)[0x7f922c9f1b01] /opt/ipopt/Ipopt-3.11.9/lib/libipopt.so.1(_ZN5Ipopt9IpoptData24InitializeDataStructuresERNS_8IpoptNLPEbbbbb+0xe4)[0x7f922c9cc524] /opt/ipopt/Ipopt-3.11.9/lib/libipopt.so.1(_ZN5Ipopt25DefaultIterateInitializer18SetInitialIteratesEv+0x3f)[0x7f922c994f2f] /opt/ipopt/Ipopt-3.11.9/lib/libipopt.so.1(_ZN5Ipopt14IpoptAlgorithm18InitializeIteratesEv+0xf)[0x7f922c9a666f] /opt/ipopt/Ipopt-3.11.9/lib/libipopt.so.1(_ZN5Ipopt14IpoptAlgorithm8OptimizeEb+0xa6)[0x7f922c9aab96] /opt/ipopt/Ipopt-3.11.9/lib/libipopt.so.1(_ZN5Ipopt16IpoptApplication13call_optimizeEv+0x444)[0x7f922c93bbb4] /opt/ipopt/Ipopt-3.11.9/lib/libipopt.so.1(_ZN5Ipopt16IpoptApplication11OptimizeNLPERKNS_8SmartPtrINS_3NLPEEERNS1_INS_16AlgorithmBuilderEEE+0x14d)[0x7f922c93f95d] /opt/ipopt/Ipopt-3.11.9/lib/libipopt.so.1(_ZN5Ipopt16IpoptApplication11OptimizeNLPERKNS_8SmartPtrINS_3NLPEEE+0x18)[0x7f922c940908] /opt/ipopt/Ipopt-3.11.9/lib/libipopt.so.1(_ZN5Ipopt16IpoptApplication12OptimizeTNLPERKNS_8SmartPtrINS_4TNLPEEE+0xca)[0x7f922c93b71a] ./cpp_example[0x40242e] /lib/x86_64-linux-gnu/libc.so.6(libc_start_main+0xed)[0x7f922916976d] ./cpp_example[0x402951]
7f9220ce8000-7f9222ce8000 rw-p 00000000 00:00 0 7f9224ce7000-7f9226ce7000 rw-p 00000000 00:00 0 7f922781f000-7f92281dd000 rw-p 00000000 00:00 0 7f92281dd000-7f92281de000 ---p 00000000 00:00 0 7f92281de000-7f92289de000 rwxp 00000000 00:00 0 | [stack:23590] 7f92289de000-7f9228a13000 r-xp 00000000 08:06 4726701 | /usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0 7f9228a13000-7f9228c12000 ---p 00035000 08:06 4726701 | /usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0 7f9228c12000-7f9228c13000 r--p 00034000 08:06 4726701 | /usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0 7f9228c13000-7f9228c14000 rw-p 00035000 08:06 4726701 | /usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0 7f9228c14000-7f9228c2c000 r-xp 00000000 08:06 3422541 | /lib/x86_64-linux-gnu/libpthread-2.15.so 7f9228c2c000-7f9228e2b000 ---p 00018000 08:06 3422541 | /lib/x86_64-linux-gnu/libpthread-2.15.so 7f9228e2b000-7f9228e2c000 r--p 00017000 08:06 3422541 | /lib/x86_64-linux-gnu/libpthread-2.15.so 7f9228e2c000-7f9228e2d000 rw-p 00018000 08:06 3422541 | /lib/x86_64-linux-gnu/libpthread-2.15.so 7f9228e2d000-7f9228e31000 rw-p 00000000 00:00 0 7f9228e31000-7f9228f45000 r-xp 00000000 08:06 4718825 | /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0 7f9228f45000-7f9229145000 ---p 00114000 08:06 4718825 | /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0 7f9229145000-7f9229146000 r--p 00114000 08:06 4718825 | /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0 7f9229146000-7f9229148000 rw-p 00115000 08:06 4718825 | /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0 7f9229148000-7f92292fc000 r-xp 00000000 08:06 3422550 | /lib/x86_64-linux-gnu/libc-2.15.so 7f92292fc000-7f92294fb000 ---p 001b4000 08:06 3422550 | /lib/x86_64-linux-gnu/libc-2.15.so 7f92294fb000-7f92294ff000 r--p 001b3000 08:06 3422550 | /lib/x86_64-linux-gnu/libc-2.15.so 7f92294ff000-7f9229501000 rw-p 001b7000 08:06 3422550 | /lib/x86_64-linux-gnu/libc-2.15.so 7f9229501000-7f9229506000 rw-p 00000000 00:00 0 7f9229506000-7f922951b000 r-xp 00000000 08:06 3411699 | /lib/x86_64-linux-gnu/libgcc_s.so.1 7f922951b000-7f922971a000 ---p 00015000 08:06 3411699 | /lib/x86_64-linux-gnu/libgcc_s.so.1 7f922971a000-7f922971b000 r--p 00014000 08:06 3411699 | /lib/x86_64-linux-gnu/libgcc_s.so.1 7f922971b000-7f922971c000 rw-p 00015000 08:06 3411699 | /lib/x86_64-linux-gnu/libgcc_s.so.1 7f922971c000-7f9229817000 r-xp 00000000 08:06 3422539 | /lib/x86_64-linux-gnu/libm-2.15.so 7f9229817000-7f9229a16000 ---p 000fb000 08:06 3422539 | /lib/x86_64-linux-gnu/libm-2.15.so 7f9229a16000-7f9229a17000 r--p 000fa000 08:06 3422539 | /lib/x86_64-linux-gnu/libm-2.15.so 7f9229a17000-7f9229a18000 rw-p 000fb000 08:06 3422539 | /lib/x86_64-linux-gnu/libm-2.15.so 7f9229a18000-7f9229afa000 r-xp 00000000 08:06 4726757 | /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16 7f9229afa000-7f9229cf9000 ---p 000e2000 08:06 4726757 | /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16 7f9229cf9000-7f9229d01000 r--p 000e1000 08:06 4726757 | /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16 7f9229d01000-7f9229d03000 rw-p 000e9000 08:06 4726757 | /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16 7f9229d03000-7f9229d18000 rw-p 00000000 00:00 0 7f9229d18000-7f9229d61000 r-xp 00000000 08:06 1706875 | /opt/ipopt/Ipopt-3.11.9/lib/libcoinmetis.so.1.2.10 7f9229d61000-7f9229f60000 ---p 00049000 08:06 1706875 | /opt/ipopt/Ipopt-3.11.9/lib/libcoinmetis.so.1.2.10 7f9229f60000-7f9229f61000 r--p 00048000 08:06 1706875 | /opt/ipopt/Ipopt-3.11.9/lib/libcoinmetis.so.1.2.10 7f9229f61000-7f9229f62000 rw-p 00049000 08:06 1706875 | /opt/ipopt/Ipopt-3.11.9/lib/libcoinmetis.so.1.2.10 7f9229f62000-7f922b1e4000 r-xp 00000000 08:06 284427 | /usr/lib/openblas-base/libopenblas.so.0 7f922b1e4000-7f922b3e4000 ---p 01282000 08:06 284427 | /usr/lib/openblas-base/libopenblas.so.0 7f922b3e4000-7f922b3eb000 r--p 01282000 08:06 284427 | /usr/lib/openblas-base/libopenblas.so.0 7f922b3eb000-7f922b3f9000 rw-p 01289000 08:06 284427 | /usr/lib/openblas-base/libopenblas.so.0 7f922b3f9000-7f922b401000 rw-p 00000000 00:00 0 7f922b401000-7f922b549000 r-xp 00000000 08:06 1706887 | /opt/ipopt/Ipopt-3.11.9/lib/libcoinhsl.so.1.4.6 7f922b549000-7f922b748000 ---p 00148000 08:06 1706887 | /opt/ipopt/Ipopt-3.11.9/lib/libcoinhsl.so.1.4.6 7f922b748000-7f922b749000 r--p 00147000 08:06 1706887 | /opt/ipopt/Ipopt-3.11.9/lib/libcoinhsl.so.1.4.6 7f922b749000-7f922b74b000 rw-p 00148000 08:06 1706887 | /opt/ipopt/Ipopt-3.11.9/lib/libcoinhsl.so.1.4.6 7f922b74b000-7f922b8d9000 r-xp 00000000 08:06 1706896 | /opt/ipopt/Ipopt-3.11.9/lib/libcoinmumps.so.1.4.13 7f922b8d9000-7f922bad8000 ---p 0018e000 08:06 1706896 | /opt/ipopt/Ipopt-3.11.9/lib/libcoinmumps.so.1.4.13 7f922bad8000-7f922bad9000 r--p 0018d000 08:06 1706896 | /opt/ipopt/Ipopt-3.11.9/lib/libcoinmumps.so.1.4.13 7f922bad9000-7f922badb000 rw-p 0018e000 08:06 1706896 | /opt/ipopt/Ipopt-3.11.9/lib/libcoinmumps.so.1.4.13 7f922badb000-7f922bade000 rw-p 00000000 00:00 0 7f922bade000-7f922bae0000 r-xp 00000000 08:06 3422554 | /lib/x86_64-linux-gnu/libdl-2.15.so 7f922bae0000-7f922bce0000 ---p 00002000 08:06 3422554 | /lib/x86_64-linux-gnu/libdl-2.15.so 7f922bce0000-7f922bce1000 r--p 00002000 08:06 3422554 | /lib/x86_64-linux-gnu/libdl-2.15.so 7f922bce1000-7f922bce2000 rw-p 00003000 08:06 3422554 | /lib/x86_64-linux-gnu/libdl-2.15.so 7f922bce2000-7f922c5c7000 r-xp 00000000 08:06 956770 | /usr/lib/lapack/liblapack.so.3gf.0 7f922c5c7000-7f922c7c6000 ---p 008e5000 08:06 956770 | /usr/lib/lapack/liblapack.so.3gf.0 7f922c7c6000-7f922c7c7000 r--p 008e4000 08:06 956770 | /usr/lib/lapack/liblapack.so.3gf.0 7f922c7c7000-7f922c7cb000 rw-p 008e5000 08:06 956770 | /usr/lib/lapack/liblapack.so.3gf.0 7f922c7cb000-7f922c8d8000 rw-p 00000000 00:00 0 7f922c8d8000-7f922cb00000 r-xp 00000000 08:06 1706936 | /opt/ipopt/Ipopt-3.11.9/lib/libipopt.so.1.9.9 7f922cb00000-7f922cd00000 ---p 00228000 08:06 1706936 | /opt/ipopt/Ipopt-3.11.9/lib/libipopt.so.1.9.9 7f922cd00000-7f922cd07000 r--p 00228000 08:06 1706936 | /opt/ipopt/Ipopt-3.11.9/lib/libipopt.so.1.9.9 7f922cd07000-7f922cd0a000 rw-p 0022f000 08:06 1706936 | /opt/ipopt/Ipopt-3.11.9/lib/libipopt.so.1.9.9 7f922cd0a000-7f922cd2c000 r-xp 00000000 08:06 3422543 | /lib/x86_64-linux-gnu/ld-2.15.so 7f922cf06000-7f922cf10000 rw-p 00000000 00:00 0 7f922cf25000-7f922cf28000 rw-p 00000000 00:00 0 7f922cf28000-7f922cf29000 rw-s 00000000 00:04 5144577 | /SYSV00510510 (deleted) 7f922cf29000-7f922cf2a000 rw-s 00000000 00:04 5373952 | /SYSV00000000 (deleted) 7f922cf2a000-7f922cf2c000 rw-p 00000000 00:00 0 7f922cf2c000-7f922cf2d000 r--p 00022000 08:06 3422543 | /lib/x86_64-linux-gnu/ld-2.15.so 7f922cf2d000-7f922cf2f000 rw-p 00023000 08:06 3422543 | /lib/x86_64-linux-gnu/ld-2.15.so 7fff8028f000-7fff802ae000 rwxp 00000000 00:00 0 | [stack] 7fff802ae000-7fff802b0000 rw-p 00000000 00:00 0 7fff803ad000-7fff803af000 r-xp 00000000 00:00 0 | [vdso] ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 | [vsyscall] ./run.IPOPT.sh: line 138: 23589 Aborted | (core dumped) ./cpp_example < input.parameters > output.optimization
I just declare 6 pointers, 4 pointers to take input 4 data variables, and 2 pointers to save data after generating. But when i run the code, there are some errors. /------------------ Memory Allocation /------------------ 1d arrays
x_positions = (double *) calloc(number_unknowns-2, sizeof (double));
y_positions = (double ) calloc(number_unknowns-2, sizeof (double)); Kx_samples = (double ) calloc(number_samples, sizeof (double)); Ky_samples = (double ) calloc(number_samples, sizeof (double)); CP_re = (double ) calloc(number_unknowns-2, sizeof(double)); CP_im = (double *) calloc(number_unknowns-2, sizeof(double));
/--------------- Free Memory /--------------
free(x_positions);
free(y_positions); free(Kx_samples); free(Ky_samples); free(CP_re); free(CP_im);