I want to measure the consumption of memory that implies certain action (upload a pdf with the library pdfbox), with the purpose of to determine in approximate form (to know if it puts all the pdf in single memory or the structure of this).
Printable View
I want to measure the consumption of memory that implies certain action (upload a pdf with the library pdfbox), with the purpose of to determine in approximate form (to know if it puts all the pdf in single memory or the structure of this).
Try something like that:
Code:System.out.println(Runtime.getRuntime().freeMemory());
long memoryBefore = Runtime.getRuntime().freeMemory();
PDDocument document = PDDocument.load("c:\\01.pdf");
long memoryAfter = Runtime.getRuntime().freeMemory();
System.out.println( (memoryBefore -long memoryAfter));