8 Replies Latest reply on Jun 21, 2013 2:57 AM by alex.zuz

    [IDS Win]How to flush Indesign server.

    Rahul Dalvi
      Hi All,
      I am using Indesign server to create documents which contains text, images & tables. My job is to create & export documents to pdf. Document are sometimes contains 300 plus pages. And cs2 server process this jobs one after the other in queue ..may be 100 jobs in a queue. Here after certain amount of time a 'out of memory' error comes up and Indesign server gets crashed(its around after processing 30-40 jobs).
      I have taken care to delete all allocated meomary in my program through New- delete pair. Still after each job allocated memory to Indesign keeps increasing.
      Is there any way so that I can purge memory from Indesign after my job complition? I tried to use 'PurgeMemory' over IDocumentList but its not that effective.
      Any suggestions are most welcommed!

        • 1. Re: [IDS Win]How to flush Indesign server.
          The way we dot it (not the most beautifull):

          A manager application that calls the soap interface gives executes an "app.quit()" call every n documents.

          IndesignServer is started from a batch script, that directly starts it up after it has been shut down.

          • 2. Re: [IDS Win]How to flush Indesign server.
            Rahul Dalvi Level 1
            Hi Klaasjan,

            Thanks for your reply. Here I can not quit the application as I have a number of jobs (soap request to Indesign) in a queue, so if I quit the queue will get lost.

            • 3. Re: [IDS Win]How to flush Indesign server.
              Level 1
              Hi Rahul,

              Is there a way to balance your job in a managing process that connects through SOAP to the ID-server? In this way you will stay in control, instead of waiting for an unidentifiable queue on the ID-server.

              • 4. Re: [IDS Win]How to flush Indesign server.
                Rajeev Kumar MIL
                Hi Rahul,
                I am very new for InDesign Server. I am trying to learn it, I am not too much technical like you, I am a very slow learner, I am trying to run testclient sample but unable to to it.

                DO you have any documentation on indesign server cs2. I have a lot of question in my mind like how to import XML file to generate indesign file or how can i export pdf, etc.

                Please help me if you don't mind.
                • 5. Re: [IDS Win]How to flush Indesign server.
                  We had the same problem, but then I found this in the documentation:
                  "In Memory Message Log for InDesign Server

                  By default, InDesignServer maintains an in memory message log. Every message that is logged to the console is also logged internally. These messages can be retrieved by plug-ins. (See the SDK for info on the IErrorList interface). The in memory error list is not cleared, unless it is explicitly cleared by a third party plug-in or from a script. This means that by default there is a slow memory growth resulting from log messages accumulating in the in memory message
                  log. The in memory message log can be turned off by specifying the noerrorlist option on the command line when starting the server. This will prevent accumulation of log messages in memory and prevent the resulting memory growth."
                  • 6. Re: [IDS Win]How to flush Indesign server.

                    Are you using JavaScript to drive InDesign Server? Are you closing each document?

                    What Jakob says about the error list is true. But it is a pretty slow leak. It would take many days to run out of memory due to the error list. In CS3 the error list is off by default.

                    • 7. Re: [IDS Win]How to flush Indesign server.

                      Well, it's been two years since the last activity in this thread, and I am having this exact same problem with InDesign Server CS4.


                      I have a .NET web application that calls the IDS through SOAP and simply tells it to run a JavaScript.  In simple terms, the script opens an InDesign file, imports some XML, makes some minor formatting changes, and exports the PDF to the filesystem.  The .NET webapp then receives the status message and redirects the user directly to the finished PDF which they can then view/save/etc.


                      This all works perfectly, but while it's running, I see the memory usage of InDesignServer.exe spike by several MB, and then it settles back down to a still-higher-than-initial value. Eventually, the InDesignServer.exe is taking up several hundred MB and my server starts giving out-of-memory errors.


                      I'm not sure what I'm doing wrong. Like the original poster asked, it appears as though I should be flushing something that I am not. I've researched this "ErrorList" that was referenced, and my memory "leak" seems to be bigger than this (although I could be wrong), but I can't find anything in the language reference on how to programmatically flush this after each document. I'm not even sure if this is the culprit.


                      Can anybody help? Many many thanks in advance


                      The contents of my JavaScript is as follows (and you'll see that I'm closing the document each time):




                      // We encapsulate the meat of the code in a main() function and then call main() at

                      // the bottom of the script in order to facilitate proper returns

                      // see http://ericwillis.wordpress.com/2008/04/18/return-value-from-indesign-server-script-via-so ap/

                      function main()


                           // Our script requires a school code to be passed in as an argument

                           // We begin by assuming that it hasn't been passed

                           var message='Error: schoolCode parameter required';


                           // if the argument HAS been passed...



                                // We change our return message and proceed with processing

                                 message='Success: No problems reported';


                                // This is our work folder

                                var projectPath='/E/mywebsite/';


                                // this is our starting template

                                var doc = app.open(File(projectPath + 'source/Template.indd'));


                                // the template has been "tagged" with XML placeholders, so here we are

                                // importing the data to replace them. The filename of the XML is

                                // dependent on the school code that was passed as an argument

                                doc.importXML(File(projectPath + 'work/' + app.scriptArgs.getValue('schoolCode') + '.xml'));


                                // The next portion of the script scans the entire document for overset

                                // text (text that flows outside of it's container). If any is found, it changes

                                // the text colour to red so that the author knows that they overtyped


                                //Create a color.




                                catch (myError)


                                     doc.colors.add({name:"Red", model:ColorModel.process, colorValue:[20, 100, 80, 10]});



                                // loop through each "story"



                                     // if the current story has overset text...



                                          // change the text colour to our previously created colour

                                          doc.stories.item(x).fillColor = doc.colors.item("Red");


                                          // Change the message too so that we know on the server side

                                          // that there's a problem

                                          message='Warning: Contains overset text';



                                     // We couldn't find a way to use styles to place an outside border

                                     // around a variable-width & length table that we're creating

                                     // dynamically in the XML. To solve this, the following loop finds all

                                    // of the tables in the document and places a border around their

                                    // outside-most edges only


                                     // Loop through each table in this story



                                          // myTable will refer to each table

                                          var myTable=doc.stories.item(x).tables.item(y);


                                          // Header stroke

                                          var myRow=myTable.rows.item(0);







                                          // Do left border

                                          var myCol=myTable.columns.item(0);







                                          // Do right border

                                          var myCol=myTable.columns.item(myTable.columns.length-1);







                                          // Do bottom border

                                          var myRow=myTable.rows.item(myTable.rows.length-1);









                                // Set some PDF export prefs






                                // Export the PDF to the filesystem

                                // the filename is dependent on the school code that was passed

                                // as an argument

                                doc.exportFile(ExportFormat.PDF_TYPE, File(projectPath + 'work/' + app.scriptArgs.getValue('schoolCode') + '.pdf'));


                                // Close the document




                           // Return whatever message was produced by this function

                           return message;


                      // call our main function


                      • 8. Re: [IDS Win]How to flush Indesign server.

                        I have te same problem, have you found a solution?