possible memleak?

Søren Hauberg soren at hauberg.org
Mon Mar 2 11:55:39 CST 2009


Hi All

I have the following program

"
## Sample points on the image plane
grid_size = 250;
[ip_y, ip_z] = meshgrid (linspace (-10, 10, grid_size));
ip_x = repmat (3, size (ip_z));

## Compute a Gaussian
mu = [7; 1; 3];
Sigma = 2.5*rand (3); Sigma = Sigma.' * Sigma;
[vec, val] = eig (Sigma);

## Render probability map
map = zeros (size (ip_x));
for r = 1:rows (ip_x)
  for c = 1:columns (ip_y)
    ## Build the function for integration
    alpha = [ip_x(r, c); ip_y(r, c); ip_z(r, c)];
    f = @(t) mvnpdf (alpha.'*t, mu.', Sigma);
    
    ## Perform numerical integration
    map (r, c) = quad (f, -inf, inf);
  endfor
endfor
"

But it cannot finish since I run out of memory. The odd part is that I
run out of memory during the for-loops, i.e. after all memory has been
allocated. I'm I missing something obvious here, or do we have a
memleak?

Søren

P.S. The function 'mvnpdf' is part of the 'statistics' package. I'm
attaching it to this mail. 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mvnpdf.m
Type: text/x-matlab
Size: 1895 bytes
Desc: not available
Url : https://www-old.cae.wisc.edu/pipermail/bug-octave/attachments/20090302/86581ed8/attachment.bin 


More information about the Bug-octave mailing list