0

I have a code like this

import java.io.*;
public class Test{    
    public static void main(String ars[]){
        try{
            Runtime rt=Runtime.getRuntime();
            Process pr=rt.exec("a.exe"); 
            BufferedReader input=new BufferedReader(new InputStreamReader(pr.getInputStream()));

How to limit the memory used by the a.exe ( like stop the execution after say 100MB) ?

Vivek Aditya
  • 1,145
  • 17
  • 46
  • downvoters can explain please – Vivek Aditya May 26 '15 at 13:11
  • 2
    You are asking how to manage an application outside of the JVM. The simple answer is, you don't. Is it possible? Sure, by calling all kinds of scripts and other applications. But that is far more complicated and difficult than managing that without the java code. Better to write a system script to handle it. – MadConan May 26 '15 at 13:17
  • From Java, you dont want to do that. http://stackoverflow.com/questions/192876/set-windows-process-or-user-memory-limit – aksappy May 26 '15 at 13:31

0 Answers0