The size() function is from the base. fes.conn is a 2D array of ints. P
On Friday, January 9, 2015 at 11:25:34 AM UTC-8, Tim Holy wrote: > > I wonder if your `size` function isn't returning an Int, or that the > compiler > can't infer that. Did you try this on julia 0.4 with @code_warntype? > > --Tim > > On Friday, January 09, 2015 08:06:43 AM Petr Krysl wrote: > > Actually, I realized that the example shows the same problem, but for a > > different function. This time the allocation occurs in the function > > CALLING getconn!. > > > > P > > > > On Friday, January 9, 2015 at 8:03:00 AM UTC-8, Petr Krysl wrote: > > > Tim, > > > > > > Your explanation is very helpful. There is a complication though: > > > The function is actually called from another function (from a chain > of > > > > > > functions). Here is the measurement from a simplified situation: > > > - using JFFoundationModule > > > - using FESetModule > > > - > > > - n=100; > > > - function test(n) > > > 0 fes=FESetH8(conn=rand(JFInt,n, > > > > > > 8)) > > > > > > 112 conn1::JFIntMat=zeros(JFInt,nfense(fes),1); > > > > > > 6383704 for j=1:size(fes.conn,1) > > > > > > 0 getconn!(fes,conn1,j); > > > - end > > > 0 return true > > > - end > > > - > > > - test(n) > > > - clear_malloc_data() > > > - n=100000; > > > - test(n) > > > > > > As you can see the loop over the rows of the array fes.conn allocates > > > substantial amount of memory. > > > > > > Here is the type: > > > https://gist.github.com/PetrKryslUCSD/794f521a8e5b057e5e4e > > > > > > Petr > >
