MATLAB Answers

What could be causing this memory issue?

3 views (last 30 days)
Ibro Tutic
Ibro Tutic on 9 Aug 2017
Commented: Jan on 10 Aug 2017
I am processing some data and everything works as intended, with memory used hovering right around 4.5 gb. I am opening .dat files, writing data to a structure, saving the structure, and then I clear the .dat file and the structure to make room for the next file to process. Everything works perfectly, until the file size goes from 9 mb to 18 mb. All of a sudden my ram usage literally shoots up to 16 gb (see picture below for more info, wasn't able to get a print screen because computer locked up). What could be the issue here? I have a pretty good feeling that it isn't my code, since it works fine until the file size increases by 9 mb, which should not use 10+ gb of memory.

  2 Comments

aborghes
aborghes on 9 Aug 2017
Hi Ibro,
Is it possible for you to share your code and .dat files? Without them it is hard to diagnose the issue.
Jan
Jan on 10 Aug 2017
@Ibro: It is impossible to guess the reason without seeing the code. Perhaps there is a zeros(n) anywhere, when zeros(1,n) is meant. Or a forgotten pre-allocation can use a lot of memory.
Try to find out, if the problem is reproducible and if so, in which part of the code it happens.

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by