From 7716ed24d119693f4f3da5654ce231a067a9b041 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 10 May 2017 21:50:25 +0200 Subject: [PATCH] Memory leak --- plugins/Full_CI_ZMQ/run_selection_slave.irp.f | 24 +++++++++---------- plugins/Full_CI_ZMQ/selection_buffer.irp.f | 8 +++---- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/plugins/Full_CI_ZMQ/run_selection_slave.irp.f b/plugins/Full_CI_ZMQ/run_selection_slave.irp.f index 3a9f7a96..9997ff71 100644 --- a/plugins/Full_CI_ZMQ/run_selection_slave.irp.f +++ b/plugins/Full_CI_ZMQ/run_selection_slave.irp.f @@ -93,21 +93,21 @@ subroutine push_selection_results(zmq_socket_push, pt2, b, task_id, ntask) integer :: rc rc = f77_zmq_send( zmq_socket_push, b%cur, 4, ZMQ_SNDMORE) - if(rc /= 4) stop "push" + if(rc /= 4) stop "push1" rc = f77_zmq_send( zmq_socket_push, pt2, 8*N_states, ZMQ_SNDMORE) - if(rc /= 8*N_states) stop "push" + if(rc /= 8*N_states) stop "push2" rc = f77_zmq_send( zmq_socket_push, b%val(1), 8*b%cur, ZMQ_SNDMORE) - if(rc /= 8*b%cur) stop "push" + if(rc /= 8*b%cur) stop "push3" rc = f77_zmq_send( zmq_socket_push, b%det(1,1,1), bit_kind*N_int*2*b%cur, ZMQ_SNDMORE) - if(rc /= bit_kind*N_int*2*b%cur) stop "push" + if(rc /= bit_kind*N_int*2*b%cur) stop "push4" rc = f77_zmq_send( zmq_socket_push, ntask, 4, ZMQ_SNDMORE) - if(rc /= 4) stop "push" + if(rc /= 4) stop "push5" rc = f77_zmq_send( zmq_socket_push, task_id(1), ntask*4, 0) - if(rc /= 4*ntask) stop "push" + if(rc /= 4*ntask) stop "push6" ! Activate is zmq_socket_push is a REQ ! rc = f77_zmq_recv( zmq_socket_push, task_id(1), ntask*4, 0) @@ -126,22 +126,22 @@ subroutine pull_selection_results(zmq_socket_pull, pt2, val, det, N, task_id, nt integer :: rc, rn, i rc = f77_zmq_recv( zmq_socket_pull, N, 4, 0) - if(rc /= 4) stop "pull" + if(rc /= 4) stop "pull1" rc = f77_zmq_recv( zmq_socket_pull, pt2, N_states*8, 0) - if(rc /= 8*N_states) stop "pull" + if(rc /= 8*N_states) stop "pull2" rc = f77_zmq_recv( zmq_socket_pull, val(1), 8*N, 0) - if(rc /= 8*N) stop "pull" + if(rc /= 8*N) stop "pull3" rc = f77_zmq_recv( zmq_socket_pull, det(1,1,1), bit_kind*N_int*2*N, 0) - if(rc /= bit_kind*N_int*2*N) stop "pull" + if(rc /= bit_kind*N_int*2*N) stop "pull4" rc = f77_zmq_recv( zmq_socket_pull, ntask, 4, 0) - if(rc /= 4) stop "pull" + if(rc /= 4) stop "pull5" rc = f77_zmq_recv( zmq_socket_pull, task_id(1), ntask*4, 0) - if(rc /= 4*ntask) stop "pull" + if(rc /= 4*ntask) stop "pull6" ! Activate is zmq_socket_pull is a REP ! rc = f77_zmq_send( zmq_socket_pull, task_id(1), ntask*4, 0) diff --git a/plugins/Full_CI_ZMQ/selection_buffer.irp.f b/plugins/Full_CI_ZMQ/selection_buffer.irp.f index 4dd0f90a..f42aa504 100644 --- a/plugins/Full_CI_ZMQ/selection_buffer.irp.f +++ b/plugins/Full_CI_ZMQ/selection_buffer.irp.f @@ -58,10 +58,6 @@ subroutine merge_selection_buffers(b1, b2) integer(bit_kind), pointer :: detmp(:,:,:) double precision, pointer :: val(:) integer :: i, i1, i2, k, nmwen - nmwen = min(b1%N, b1%cur+b2%cur) - allocate( val(size(b1%val)), detmp(N_int, 2, size(b1%det,3)) ) - i1=1 - i2=1 do while (b1%val(b1%cur) > b2%mini) b1%cur = b1%cur-1 if (b1%cur == 0) then @@ -69,6 +65,10 @@ subroutine merge_selection_buffers(b1, b2) return endif enddo + nmwen = min(b1%N, b1%cur+b2%cur) + allocate( val(size(b1%val)), detmp(N_int, 2, size(b1%det,3)) ) + i1=1 + i2=1 do i=1,nmwen if ( (i1 > b1%cur).and.(i2 > b2%cur) ) then exit