octave-bug-tracker
[Top][All Lists]

## [Octave-bug-tracker] [bug #32804] Memory leak solving linear system (lef

 From: Paolo G. Ferrandi Subject: [Octave-bug-tracker] [bug #32804] Memory leak solving linear system (left division "\") with sparse matrix Date: Wed, 16 Mar 2011 11:31:51 +0000 User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110303 Ubuntu/10.10 (maverick) Firefox/3.6.15

```URL:
<http://savannah.gnu.org/bugs/?32804>

Summary: Memory leak solving linear system (left division
"\") with sparse matrix
Project: GNU Octave
Submitted by: paolo
Submitted on: Wed 16 Mar 2011 11:31:51 AM GMT
Category: None
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: None
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 3.2.4
Operating System: GNU/Linux

_______________________________________________________

Details:

A massive memory allocation is caused by the following code. The allocated
memory is never freed until you quit GNU Octave.

nx=1000;
K=spdiags ([-ones(nx+1,1), 2*ones(nx+1,1), ...
-ones(nx+1,1)],-1:1,nx+1,nx+1);
[L,U]=lu (K);
b=ones (1001,1);
for t=1:1e6
y=L\b;
end

lu returns L as a permuted-lower sparse matrix. Since L is a lower matrix, you
can change matrix type to lower:

nx=1000;
K=spdiags ([-ones(nx+1,1), 2*ones(nx+1,1), ...
-ones(nx+1,1)],-1:1,nx+1,nx+1);
[L,U]=lu (K);
L=matrix_type (L,'lower');
b=ones (1001,1);
for t=1:1e6
y=L\b;
end

In the latter case there is not any massive memory allocation  and everything
seems to be fine.

Paolo

_______________________________________________________

<http://savannah.gnu.org/bugs/?32804>

_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/

```