Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am trying to run a tagger through batch file for different file to do so I am creating a

batch file

and running tagger through it. and this is my code..

String runap1="cd spt1"+"\n"+"java -Xss8192K -Xms128m -Xmx640m -classpath stanford-postagger.jar edu.stanford.nlp.tagger.maxent.MaxentTagger -model models/bidirectional-wsj-0-18.tagger -textFile "+fff[g]+">tag\\"+r1+"\nexit" ;

                 ////////////////
  FileWriter fw1 = new FileWriter("ac.bat");
                  BufferedWriter bw1 = new BufferedWriter(fw1);

 bw1.write(runap1);
                 bw1.close();

  Runtime rx= Runtime.getRuntime();
    Process p=null;
     try
     {
    p=rx.exec("cmd.exe /c start ac.bat");

     }
     catch(Exception e)
      {
      System.out.println("Error");
       }// TOD}
     try
{Thread.sleep(15000);}
catch (InterruptedException e)
{  System.out.println("Thread interrupted");

}

this takes a long time to process and several times my pc being hanged. I want to make a shared memory for the tagger to load it only once and all batch files will use that shared tagger, they should not load tagger each time. How can I do this?

share|improve this question

1 Answer

If you store you data in a memory mapped file, you can load it multiple times across processes without additional copies. You can even make changes in one process and see than changes in another.

The problem with this is you have to work with off heap memory. This works simplest if the data file is already in a binary form you can use. i.e. you don't need to parse it.

share

Your Answer

 
discard

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.