1

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.

Berg
  • 1,059
  • 5
  • 14

1 Answers1

4
(* make the task, fires once a minute *)
task = CreateScheduledTask[PutAppend[MemoryInUse[], "myMemory.log"], 60];

(* start the task *)
StartScheduledTask[task]

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

(* stop (or remove) the task *)
StopScheduledTask[task]

RemoveScheduledTask[task]
ciao
  • 25,774
  • 2
  • 58
  • 139