#include "ga.h"
int ga_free( GA ga )
{
    int flag;
    void *ga_win_ptr;

    MPI_Win_get_attr( ga->ga_win, MPI_WIN_BASE, &ga_win_ptr,
		      &flag );
    if (!flag) return 1;
    MPI_Win_free( &ga->ga_win );
    MPE_Mutex_free( &ga->lock_win );
    MPI_Free_mem( ga_win_ptr );

    free(ga);
    return 0;
}
