Recent Projects


you seem to experience exactly the same symptoms as I sometimes do. That it’s related to Azureus or the fullscreen mode (where for the lag happens most often) is just wild guesswork from my side.

Could someone please send me a project that this is happening to? You can make a copy of the project and then garbage the words with a global replace if you don’t want me to see your actual text (by just replacing random letters - eg. “r” for “p” etc until the text is gibberish but the word and character counts are still the same). I only have a 2GhZ, 1Gb MacBook to test on right now (as I am away from home), so it would be best if the project is already lagging on such a system.

How many words/chars are there in the documents that lag?

Have you opened up lots and lots of long documents in the project before the lag comes into play, or does it happen even when opening the project and working on the first document?

I have done my absolute best throughout to ensure that there is no typing lag - this has been a major consideration from day one - so this worries me and I would like to get to the bottom of it ASAP.


This developer article might be of some small help with this issue. … emory.html

and … mance.html


Hi Keith. I would send you my project, but I’m not sure I can. It’s rather large–37 mbs, so even zipped it will be huge. It was larger than that but I took a huge chunk of it (all research material) and moved it to DTPro in the hopes it would help this lag problem.

Also, I’m guessing perhaps it starts to happen when the project has been open a while or the computer has been sleeping and not restarted for a while. I have tried typing into the files it happened with right after having my computer shut down and then rebooting and it isn’t nearly as pronounced. I even tried copying the same large file three or four times into a new entry to make it really huge and there is no significant lag.

So I’m guessing as of right now it’s more the first part of your second question–it happens after opening lots of long documents. When I’m working in this particular project, it definitely involves a lot of moving back and forth between substantial documents (looking at research documents then going back to what I’m writing, etc.). It starts to happen with entries that are at about 23K characters or thereabouts.

I will have to start observing more carefully. When it happens I’m usually in a huge rush to get it done so I open it in iText Express and finish it there. I haven’t had it happen since first posting only because I haven’t been working much through the holidays. I’ll be back today a bit and this week and in earnest next week, so I will definitely really look at what is happening and when it’s happening, etc. Sorry I can’t be more specific!


I have 1.25 gbs of memory in my iBook, btw. Running 10.4.6 (10.4.8 created sleep issues for my iBook so I had to go back). And usually the only other programs I have open are Mail, Safari, Sidenote, iClip, DT Pro and maybe Preview or iText Express. When I check Activity Monitor I never see anything using up the CPU, so it doesn’t seem anything else is running at the time.

Well, have to go, but will try to clarify this issue even more when I can.


From what you say, I wonder if it is just that Scrivener keeps all of the files you have opened so far hanging around in memory. Could you try one thing for me? Next time you experience the lag (if it has occurred after working on the project for a while and you have opened lots of documents during the session), could you close Scrivener (or just the project with the lag), then reopen the project and start typing again straight away in the document that had the lag? If the lag has gone away, it suggests that it is caused by the stuff Scrivener is keeping around in memory. And if so, the fix I proposed to Lord Lightning may well fix things…

I think I can second alexwein’s observations. I experienced the lag after I have been working on a project for some time (1+ hour). Also, I tend to move back and forth between documents. Usually I mainly work on one document (chapter) but often have to go back to previous chapters of look up something about a character. But none of the documents is what I would call particularily large.

Next time I experience the lag I will do as you, Keith, suggested to alexwein.

Keith, I will send you my project via e-mail. It’s in German, so I won’t bother obfuscating it. I only would like to ask you to trash it once you’re done researching.

For me the lag doesn’t seem to be as serious as for alexwein. I have no problems continuing my work. It’s more a slight “stutter”.

For what it’s worth: In the good old OpenStep days I remember the autorelease pool to sometimes cause an application becoming unresponsive for the fraction of a second, especially if you had created a lot of short living objects. The autorelease pool is cleared at the end of an event cycle, and because a key stroke triggers such an event, you might want to look into this. But these are just my 2 cent because I don’t have any recent experience with Cocoa programming.

Will do, Keith. I had that in mind–the memory thing occurred to me as well. I will also monitor things more closely to see if the lag occurs at other times–but right now I don’t believe it will.

A rough gauge of whether you need more ram is to wait until whatever slowdown you are experiencing occurs, and then in terminal do:

du -h /var/vm/

This shows how much space your swapfiles are using. If you consistently have more than 3-4 swapfiles, you are probably low on memory.

Another little trick is to run a command-line program and record the output in a file for later perusal.
For example:
top -l 0 -s 10> myoutput.txt
(that’s “minus ell zero minus ess ten”)
will run the ‘top’ command and save the output in the file “myoutput.txt”. After you have been using Scrivener for a short while, quit and stop the ‘top’ command by typing Control-C in the Terminal window, then look at the file with a text editor (e.g TextEdit).

I was also thinking that maybe it might be something simple such as memory leakage?

This sort of thing (about 10.2.6.- but clearly written): … -leaks.php

Thinking maybe struct timespec sleepTime; and struct timespec rem

There seems to be a time factor involved as well as a memory problem.

Just guessing!

Bill Bumgarner observes that:

In a Terminal window…

setenv MallocStackLogging /path/to/

… you should see a diagnostic message like …

malloc[PID]: recording stacks using standard recorder

… then, in another Terminal window…

leaks PID

… do whatever it is in the app that you suspect causes leaks. The leaks process will print detailed information about the leak, including the backtrace of the appropriate thread within the application at the time the memory was allocated.

Bumgarner says that if you find a leak in the AppKit or other library code, make sure it isn’t a code path through your own code that is the real cause of the leak. Apple is generally very good about making sure the various frameworks don’t leak memory, but that assumes that the API is being called in the proper fashion.

Some useful man pages:

leaks - Search a process’s memory for unreferenced malloc buffers
heap - List all the malloc-allocated buffers in the process’s heap
malloc - memory allocation
malloc_history - Show the malloc allocations that the process has performed
MallocOptions - Malloc options release notes
Memory Performance - Memory Management & Memory Optimization guide

This technical developer note is also very useful: