[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Getfem-users] memory problem with gf_asm()
From: |
Julien Pommier |
Subject: |
Re: [Getfem-users] memory problem with gf_asm() |
Date: |
Sun, 12 Oct 2008 15:08:11 +0200 |
User-agent: |
Internet Messaging Program (IMP) 3.2.6 |
Hi,
I have committed a patch ( http://svn.gna.org/viewcvs/getfem?rev=2832&view=rev )
that should fix that leak.
For the record, here is how I proceed in order to track leaks in the matlab
interface. For that, I use the valgrind program , the getfem/matlab rpc
interface. Indeed the rpc interface was written for that very purpose.
With that interface, getfem runs as a separate process from matlab, so it is
possible to debug it , and track memory leaks without interferences with the
huge and bloated matlab process. Communication between the getfem_server
program and the matlab program is performed by a small mex-file gf_matlab that
communicates with the getfem_server using RPC (Remote Procedure Calls).
compilation:
./configure --enable-matlab --enable-matlab-rpc
make
that builds a program "getfem_server" in interface/src
and the usual mex-file "gf_matlab.mexglx" in interface/src/matlab
now, just run the server under valgrind:
valgrind --leak-check=yes getfem_server -tcp
and in matlab, just type
>> gf_workspace('connect','localhost');
in order to connect to the getfem_server you just created. (if you do not do
that, it will just create another getfem_server process and communicate with
it, and kill it when it's done)
then do your stuff you want to check in matlab, and kill the server with:
>> gf_matlab('exit')
At that point, valgrind will list the memory leaks that occured, and at which
point they occured. Very handy !
--
Julien
Quoting Hicham Tber <address@hidden>:
> Hi Ronan
>
> I've got the same problem although using an external subroutine calling
> push-pop.
>
> Hicham
> > Hi Hicham,
> >
> > maybe you should follow the example on the documentation page
> > concerning gf_workspace :
> > http://download.gna.org/getfem/doc/getfem_matlab/gfm_18.html
> >
> > Nevertheless, even with these instructions I have also some problems
> > for managing the memory used by getfem in matlab : I call an external
> > subroutine, which follows the advices of the documentation concerning
> > gf_workspace, but after several calls of the subroutine matlab finally
> > crashes.
> > Does someone experiment the same behavior?
> >
> > Best regards,
> > Ronan
> >
> > Hicham Tber a écrit :
> >> Hello,
> >> I am using gf_asm(), from the Matlab interface, inside a loop. I
> >> realized that the used memory increases with iterations until my
> >> program runs out of memory. I would like to know if this is a bug or
> >> just something wrong with my program. The example below illustrate my
> >> problem.
> >>
> >> Thank you in advance.
> >>
> >> Hicham
> >>
> >>
> >> %
> >> % dx = 0.01;
> >> Omega = gf_mesh('triangles grid',[0:dx:1],[0:dx:1]);
> >> Vh = gf_mesh_fem(Omega,1);
> >> gf_mesh_fem_set(Vh,'fem',gf_fem('FEM_PK(2,1)'));
> >> im = gf_mesh_im(Omega, gf_integ('IM_EXACT_SIMPLEX(2)')) ;
> >> VhNdof=gf_mesh_fem_get(Vh, 'nbdof');
> >>
> >> e = ones(VhNdof,1); Nmax = 100;
> >>
> >> for k = 1:Nmax
> >> Mat = gf_asm('laplacian', im, Vh, Vh, ones(1,VhNdof));
> >> % memory monitoring on Linux !free -m
> >> end
> >> %%
> >>
> >>
> >>
> >>
> >>
> >> _______________________________________________
> >> Getfem-users mailing list
> >> address@hidden
> >> https://mail.gna.org/listinfo/getfem-users
> >>
> >>
> >
>
>
> _______________________________________________
> Getfem-users mailing list
> address@hidden
> https://mail.gna.org/listinfo/getfem-users
>