excessive memory use for repeated call to multiply functions

Issue #54 invalid
Former user created an issue

Hi,

First, thanks for library. It is great.

When I try to call the multiply functions repeatedly (naive or m4ri), memory usage is increased a lot until I get "m4ri_mm_malloc: malloc returned NULL" and the application halts. It seems to me, there could be a possible memory allocation without freeing. The following program show what I mean. PS. I use 64-bit windows 7, with Mingw. Thanks,

#define SIZE 64 int main() { mzd_t A, T; int a;

A = mzd_init(SIZE, SIZE);
T = mzd_init(SIZE, SIZE);

mzd_randomize(A);

for(a=0; a<10000000; a++){
    mzd_randomize(T);
    T = mzd_mul_naive(NULL, A, T);
}   
return 0;

}

Comments (2)

  1. Martin Albrecht repo owner

    Hi,

    this is not a bug but a mistake in calling the matrix. The line:

    T = mzd_mul_naive(NULL, A, T);
    

    allocates a new matrix, multiplies A and T, and overwrites the T pointer to point to the new product. Hence, T is not freed.

  2. Log in to comment