@ RequestMapping (value="https://bbs.csdn.net/test")
@ ResponseBody
Public Result
public static ImageInfo getRGBData (File File) {
If (the file==null)
return null;
ImageInfo ImageInfo;
Try {
//the image file is loaded into the memory buffer
BufferedImage image=ImageIO. Read (file);
Image. The flush ();
} the catch (IOException e) {
e.printStackTrace();
return null;
}
return null;
}
A pure spring boot project has just started probably take up from 200 M in, cycle after 1000 times the method, G, then rose
Hope leaders help me
CodePudding user response:
Top postCodePudding user response:
The dispose ()CodePudding user response:
Tried, useless,CodePudding user response:
Look not to come out first what you returned, ImageInfo this entity class, exactly have included the whole picture of byte [] data, or only contains some aspect, the File path information, if you include the whole image, then check this method outer layer, the caller to the object returned to deposit in any list,If not included, so you changed to:
FileInputStream fis=null;
Try {
Fis=new FileInputStream (f);
ImageIO. Read (fis);
} the catch (Exception e) {
throw e;
} the finally {
CloseUtil. Close (fis);
}
The CloseUtil. Close (fis) methods:
Public class CloseUtil {
Public static void close (Closeable... Closeables) {
If (closeables==null) {
return;
}
For (Closeable Closeable: closeables) {
If (closeable!=null) {
Try {
Closeable. Close ();
} the catch (IOException e) {
}
}
}
}
}
The flow off clean, release the documents,