# Problem with SuiteSparse: memory duplication?

**URL:** https://discourse.julialang.org/t/problem-with-suitesparse-memory-duplication/78977
**Category:** General Usage
**Created:** [April 4, 2022, 3:23am UTC](https://discourse.julialang.org/t/problem-with-suitesparse-memory-duplication/78977 "2022-04-04T03:23:25Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)
#### Post date: [April 4, 2022, 3:23am UTC](https://discourse.julialang.org/t/problem-with-suitesparse-memory-duplication/78977/1 "2022-04-04T03:23:25Z")

</div>

From my reading of the SuiteSparse: In order to use one of the direct solvers, the CSC sparse matrix is converted to an internal type, `Sparse`. Unfortunately, at that point the memory used for the matrix is duplicated because SuiteSparse uses its internal storage to operate on the matrix.

If this is true, it really becomes a prohibiting factor when dealing with large systems of coupled linear algebraic equations. What is the solution? I don’t know, but I suspect that a true Julia-only solver would need to be written.

---

<div class="post-metadata">

### Author: ![viralbshah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/viralbshah/32/54_2.png) [@viralbshah](https://discourse.julialang.org/u/viralbshah)
#### Post date: [June 19, 2022, 12:10am UTC](https://discourse.julialang.org/t/problem-with-suitesparse-memory-duplication/78977/2 "2022-06-19T00:10:10Z")

</div>

Do you have some examples where this causes a memory issue? Usually, the factorizations of sparse matrices have fill in, which gets worse with larger matrices - and so this extra copy is not really a problem.

I suppose you can `decrement!` in place yourself, call the solver API directly and then `increment!` again afterwards - but be sure it is worthwhile to do that.

Writing supernodal or multifrontal sparse solvers is a lot of effort - instead just doing what I suggested above is trivial, if necessary. While it is likely a pure Julia left looking solver may come up soon (and is valuable in many situations), it only makes sense to use if your problems have very little structure.
