Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to write the MemoryInUse into a file once a minute?

In this Debugging memory leaks question there is a neat dynamic diagram showing the MemoryInUse over time. My problem is that I run my mathematica script without the front-end (math -script mystuff.m) and it seems that Dynamic does not work.

share|improve this question
Maybe PutAppend is the function you need. – Apple Mar 24 '14 at 10:04
up vote 4 down vote accepted
(* make the task, fires once a minute *)
task = CreateScheduledTask[PutAppend[MemoryInUse[], "myMemory.log"], 60];

(* start the task *)

(* ... do your thingys ... *)

(* stop (or remove) the task *)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.