Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  memory leak

    Posted 10/14/08 10:19 AM

    Originally posted by: SystemAdmin


    [fallorz said:]

    Hi i am working with cplex 11 and linux. I have a program in C, and checking with valgrind, i have found that there is a memory leak which comes from the line when cplex is open. The report by valgrind is the following.

    searching for pointers to 12 not-freed blocks.
    ==23645== checked 310,960 bytes.
    ==23645==
    ==23645== 292 (52 direct, 240 indirect) bytes in 1 blocks are definitely lost in loss record 1 of 4
    ==23645==    at 0x4C2560E: malloc (in /usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
    ==23645==    by 0x58A1468: (within /lib64/libc-2.8.so)
    ==23645==    by 0x58A1C86: __nss_database_lookup (in /lib64/libc-2.8.so)
    ==23645==    by 0x631A33F: ???
    ==23645==    by 0x631B02C: ???
    ==23645==    by 0x586029B: getpwuid_r (in /lib64/libc-2.8.so)
    ==23645==    by 0x41BB23: _ad518e3d90a8d75a58bbd1cebcf3b1da (in /users/delfos/efrain/Desktop/CMST/Subroot_Flujo/cmstSubroot)
    ==23645==    by 0x416463: _93bbb53b7ef43ee8b7bd9af9962de5e6 (in /users/delfos/efrain/Desktop/CMST/Subroot_Flujo/cmstSubroot)
    ==23645==    by 0x41FD0A: _b9859fbcaef1df17c9ca3f67cd0f5272 (in /users/delfos/efrain/Desktop/CMST/Subroot_Flujo/cmstSubroot)
    ==23645==    by 0x425E58: CPXopenCPLEX (in /users/delfos/efrain/Desktop/CMST/Subroot_Flujo/cmstSubroot)
    [i][b] [color=red][i]==23645==    by 0x40F332: main (Subroot.cpp:62)  "This line in my program is:  env = CPXopenCPLEX (&status);"[/i][/color][/b][/i]
    ==23645==
    ==23645== LEAK SUMMARY:
    ==23645==    definitely lost: 52 bytes in 1 blocks.
    ==23645==    indirectly lost: 240 bytes in 10 blocks.
    ==23645==      possibly lost: 0 bytes in 0 blocks.
    ==23645==    still reachable: 80 bytes in 1 blocks.
    ==23645==        suppressed: 0 bytes in 0 blocks.

    To close cplex i use:

          if ( lp != NULL ) {
    status = CPXfreeprob (env, &lp);
    if ( status ) {
    fprintf (stderr, "CPXfreeprob failed, error code %d.\n", status);
    }
    }
    if ( env != NULL ) {
    status = CPXcloseCPLEX (&env);
                    if ( status ) {
    char  errmsg[1024];
    fprintf (stderr, "Could not close CPLEX environment.\n");
    CPXgeterrorstring (env, status, errmsg);
    fprintf (stderr, "%s", errmsg);
    }
    }

    I don't receive any error messages. Something important to say, that the leak is always the same. It doesn't matter the size of the problem, the number of variables, etc.

    Any idea of what could be happening?  Am i forgetting something when closing cplex?

    Thanks

    Efrain




    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: memory leak

    Posted 10/15/08 07:38 AM

    Originally posted by: SystemAdmin


    [MaryFenelon said:]

    Do you get the same memory leak when running one of the examples in the CPLEX distribution?  I tried CPLEX 11.1.0 on lpex1.c with which does the free of the lp and the env in the same way you do and I don't see a leak. 
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: memory leak

    Posted 11/14/08 09:20 PM

    Originally posted by: SystemAdmin


    [fallorz said:]

    I get the same leak for lpex1.c

    here is the log:

    user/Desktop> valgrind --leak-check=yes -v lpex -r
    ==19970== Memcheck, a memory error detector.
    ==19970== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
    ==19970== Using LibVEX rev 1804, a library for dynamic binary translation.
    ==19970== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
    ==19970== Using valgrind-3.3.0, a dynamic binary instrumentation framework.
    ==19970== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
    ==19970==
    19970 Command line
    --19970--    lpex
    --19970--    -r
    19970 Startup, with flags:
    --19970--    --leak-check=yes
    --19970--    -v
    19970 Contents of /proc/version:
    --19970--  Linux version 2.6.25.16-0.1-default (geeko@buildhost) (gcc version 4.3.1 20080507 (prerelease) [gcc-4_3-branch revision 135036] (SUSE Linux) ) #1 SMP 2008-08-21 00:34:25 +0200
    19970 Arch and hwcaps: AMD64, amd64-sse2
    19970 Page sizes: currently 4096, max supported 4096
    19970 Valgrind library directory: /usr/lib64/valgrind
    19970 Reading syms from /users/delfos/efrain/Desktop/lpex (0x400000)
    19970 Reading syms from /lib64/ld-2.8.so (0x4000000)
    --19970--    object doesn't have a symbol table
    19970 Reading syms from /usr/lib64/valgrind/amd64-linux/memcheck (0x38000000)
    --19970--    object doesn't have a symbol table
    --19970--    object doesn't have a dynamic symbol table
    19970 Reading suppressions file: /usr/lib64/valgrind/default.supp
    19970 Reading syms from /usr/lib64/valgrind/amd64-linux/vgpreload_core.so (0x4A1F000)
    --19970--    object doesn't have a symbol table
    19970 Reading syms from /usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so (0x4C21000)
    --19970--    object doesn't have a symbol table
    19970 Reading syms from /lib64/libpthread-2.8.so (0x4E2A000)
    19970 Reading syms from /usr/lib64/libstdc++.so.6.0.10 (0x5046000)
    --19970--    object doesn't have a symbol table
    19970 Reading syms from /lib64/libm-2.8.so (0x5352000)
    --19970--    object doesn't have a symbol table
    19970 Reading syms from /lib64/libgcc_s.so.1 (0x55A8000)
    --19970--    object doesn't have a symbol table
    19970 Reading syms from /lib64/libc-2.8.so (0x57BF000)
    --19970--    object doesn't have a symbol table
    19970 REDIR: 0x583d400 (rindex) redirected to 0x4c25960 (rindex)
    19970 REDIR: 0x583cd10 (strlen) redirected to 0x4c25d80 (strlen)
    19970 REDIR: 0x583bdd0 (index) redirected to 0x4c25a80 (index)
    19970 REDIR: 0x5839070 (malloc) redirected to 0x4c25540 (malloc)
    19970 REDIR: 0x5839580 (realloc) redirected to 0x4c25660 (realloc)
    19970 REDIR: 0x583e140 (memmove) redirected to 0x4c26ab0 (memmove)
    19970 REDIR: 0x5840b70 (strchrnul) redirected to 0x4c26b10 (strchrnul)
    19970 REDIR: 0x583d260 (strncmp) redirected to 0x4c25fe0 (strncmp)
    19970 REDIR: 0xffffffffff600400 (???) redirected to 0x3802d08d (???)
    19970 REDIR: 0x583e2f0 (memset) redirected to 0x4c26a40 (memset)
    19970 REDIR: 0x583dbc0 (memchr) redirected to 0x4c26180 (memchr)
    19970 REDIR: 0x583fc00 (memcpy) redirected to 0x4c261d0 (memcpy)
    19970 REDIR: 0x583edf0 (mempcpy) redirected to 0x4c26b70 (mempcpy)
    19970 REDIR: 0x5836670 (free) redirected to 0x4c24240 (free)
    19970 REDIR: 0x583bf80 (strcmp) redirected to 0x4c26060 (strcmp)
    19970 REDIR: 0x583f400 (stpcpy) redirected to 0x4c267d0 (stpcpy)
    19970 REDIR: 0x5838cb0 (calloc) redirected to 0x4c23310 (calloc)
    19970 Reading syms from /lib64/libnss_compat-2.8.so (0x5F18000)
    --19970--    object doesn't have a symbol table
    19970 Reading syms from /lib64/libnsl-2.8.so (0x6120000)
    --19970--    object doesn't have a symbol table
    19970 REDIR: 0x583c2e0 (strcpy) redirected to 0x4c25de0 (strcpy)
    19970 Reading syms from /lib64/libnss_nis-2.8.so (0x6338000)
    --19970--    object doesn't have a symbol table
    19970 Reading syms from /lib64/libnss_files-2.8.so (0x6543000)
    --19970--    object doesn't have a symbol table
    19970 REDIR: 0x583d330 (strncpy) redirected to 0x4c25eb0 (strncpy)
    19970 REDIR: 0xffffffffff600000 (???) redirected to 0x3802d083 (???)
    19970 REDIR: 0x5840a50 (rawmemchr) redirected to 0x4c26b50 (rawmemchr)
    19970 Reading syms from /lib64/libnss_mdns4_minimal.so.2 (0x674F000)
    --19970--    object doesn't have a symbol table
    19970 Reading syms from /lib64/libnss_dns-2.8.so (0x6952000)
    --19970--    object doesn't have a symbol table
    19970 Reading syms from /lib64/libresolv-2.8.so (0x6B57000)
    --19970--    object doesn't have a symbol table
    19970 REDIR: 0x69f338 (_intel_fast_memcpy) redirected to 0x4c26550 (_intel_fast_memcpy)
    ILOG CPLEX 11.000, licensed to "XXXXX", options: e m b q use=10
    Tried aggregator 1 time.
    No LP presolve or aggregator reductions.
    Presolve time =    0.17 sec.

    Iteration log . . .
    Iteration:    1  Dual infeasibility =            0.000000
    Iteration:    2  Dual objective    =          202.500000

    Solution status = 1
    Solution value  = 202.500000

    Row 0:  Slack =  0.000000  Pi =  2.750000
    Row 1:  Slack =  0.000000  Pi =  0.250000
    Column 0:  Value =  40.000000  Reduced cost =  3.500000
    Column 1:  Value =  17.500000  Reduced cost =  -0.000000
    Column 2:  Value =  42.500000  Reduced cost =  -0.000000
    19970 REDIR: 0x583d0b0 (strnlen) redirected to 0x4c25d30 (strnlen)
    19970 Discarding syms at 0x5F18000-0x6120000 in /lib64/libnss_compat-2.8.so due to munmap()
    19970 Discarding syms at 0x6338000-0x6543000 in /lib64/libnss_nis-2.8.so due to munmap()
    19970 Discarding syms at 0x6120000-0x6338000 in /lib64/libnsl-2.8.so due to munmap()
    19970 Discarding syms at 0x6543000-0x674F000 in /lib64/libnss_files-2.8.so due to munmap()
    19970 Discarding syms at 0x674F000-0x6952000 in /lib64/libnss_mdns4_minimal.so.2 due to munmap()
    19970 Discarding syms at 0x6952000-0x6B57000 in /lib64/libnss_dns-2.8.so due to munmap()
    19970 Discarding syms at 0x6B57000-0x6D6C000 in /lib64/libresolv-2.8.so due to munmap()
    ==19970==
    ==19970== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 43 from 2)
    19970
    19970 supp:    30 dl-hack3-1
    19970 supp:    13 dl-hack4-64bit-1
    ==19970== malloc/free: in use at exit: 372 bytes in 12 blocks.
    ==19970== malloc/free: 434 allocs, 422 frees, 242,836 bytes allocated.
    ==19970==
    ==19970== searching for pointers to 12 not-freed blocks.
    ==19970== checked 311,856 bytes.
    ==19970==
    ==19970== 292 (52 direct, 240 indirect) bytes in 1 blocks are definitely lost in loss record 1 of 4
    ==19970==    at 0x4C2560E: malloc (in /usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
    ==19970==    by 0x58A1468: (within /lib64/libc-2.8.so)
    ==19970==    by 0x58A1C86: __nss_database_lookup (in /lib64/libc-2.8.so)
    ==19970==    by 0x5F1A33F: ???
    ==19970==    by 0x5F1B02C: ???
    ==19970==    by 0x586029B: getpwuid_r (in /lib64/libc-2.8.so)
    ==19970==    by 0x40CC87: _ad518e3d90a8d75a58bbd1cebcf3b1da (in /users/delfos/efrain/Desktop/lpex)
    ==19970==    by 0x4075C7: _93bbb53b7ef43ee8b7bd9af9962de5e6 (in /users/delfos/efrain/Desktop/lpex)
    ==19970==    by 0x410E6E: _b9859fbcaef1df17c9ca3f67cd0f5272 (in /users/delfos/efrain/Desktop/lpex)
    ==19970==    by 0x416FBC: CPXopenCPLEX (in /users/delfos/efrain/Desktop/lpex)
    ==19970==    by 0x403C26: main (lpex1.cpp:76)
    ==19970==
    ==19970== LEAK SUMMARY:
    ==19970==    definitely lost: 52 bytes in 1 blocks.
    ==19970==    indirectly lost: 240 bytes in 10 blocks.
    ==19970==      possibly lost: 0 bytes in 0 blocks.
    ==19970==    still reachable: 80 bytes in 1 blocks.
    ==19970==        suppressed: 0 bytes in 0 blocks.
    ==19970== Reachable blocks (those to which a pointer was found) are not shown.
    ==19970== To see them, rerun with: --leak-check=full --show-reachable=yes
    --19970--  memcheck: sanity checks: 8 cheap, 2 expensive
    --19970--  memcheck: auxmaps: 0 auxmap entries (0k, 0M) in use
    --19970--  memcheck: auxmaps_L1: 0 searches, 0 cmps, ratio 0:10
    --19970--  memcheck: auxmaps_L2: 0 searches, 0 nodes
    --19970--  memcheck: SMs: n_issued      = 36 (576k, 0M)
    --19970--  memcheck: SMs: n_deissued    = 2 (32k, 0M)
    --19970--  memcheck: SMs: max_noaccess  = 524287 (8388592k, 8191M)
    --19970--  memcheck: SMs: max_undefined = 0 (0k, 0M)
    --19970--  memcheck: SMs: max_defined  = 559 (8944k, 8M)
    --19970--  memcheck: SMs: max_non_DSM  = 35 (560k, 0M)
    --19970--  memcheck: max sec V bit nodes:    10 (0k, 0M)
    --19970--  memcheck: set_sec_vbits8 calls: 26 (new: 10, updates: 16)
    --19970--  memcheck: max shadow mem size:  4704k, 4M
    19970 translate:            fast SP updates identified: 12,146 ( 92.3%)
    19970 translate:  generic_known SP updates identified: 846 (  6.4%)
    19970 translate: generic_unknown SP updates identified: 160 (  1.2%)
    --19970--    tt/tc: 27,482 tt lookups requiring 31,164 probes
    --19970--    tt/tc: 27,482 fast-cache updates, 9 flushes
    --19970--  transtab: new        12,949 (336,760 -> 5,267,943; ratio 156:10) [0 scs]
    --19970--  transtab: dumped    0 (0 -> ??)
    --19970--  transtab: discarded  897 (19,674 -> ??)
    19970 scheduler: 817,447 jumps (bb entries).
    19970 scheduler: 8/15,993 major/minor sched events.
    --19970--    sanity: 9 cheap, 2 expensive checks.
    --19970--    exectx: 769 lists, 678 contexts (avg 0 per list)
    --19970--    exectx: 899 searches, 531 full compares (590 per 1000)
    --19970--    exectx: 13 cmp2, 296 cmp4, 0 cmpAll
    --19970--  errormgr: 32 supplist searches, 316 comparisons during search
    --19970--  errormgr: 43 errlist searches, 497 comparisons during search
    #CPLEXOptimizers
    #DecisionOptimization