Hi Dominik, i used -XX:+UseG1GC -XX:+UseStringDeduplication -Xmx1024m for the (java 8) vm and used VisualVM for monitoring. *used* heap was 750m reserved somehow 1.5g.....
Jan 2016-12-19 21:49 GMT+01:00 Dominik Stadler <dominik.stad...@gmx.at>: > Hi, > > How did you measure the memory consumption? Did you set -Xmx? Because if > not having -Xmx, Java will use some default based on overall available > memory and with a high amount of available memory, GC will not run and thus > lots of memory may be reported as "used", but actually just not freed > yet... > > Dominik. > > On Mon, Dec 19, 2016 at 3:26 PM, Jan Kunzmann <jan.ku...@googlemail.com> > wrote: > > > Hi, > > > > this is my firtst mail to a mailing list. > > > > I asumed that just copy via streaming would consume only little memory. > Why > > do i get 750m ram consumption for a 12m file? > > Is there any way to replace a Sheet in a Workbook without consuming tons > of > > memory? > > > > try (OPCPackage pkg = OPCPackage.open (sourceFilename, > > PackageAccess.READ)) { > > PackagePart srcPart = getPackagePart(pkg, sheetName); > > try (OPCPackage dest = OPCPackage.open(destFilename)) { > > PackagePart destPart = getPackagePart(dest, sheetName); > > try (OutputStream os = destPart.getOutputStream(); > > InputStream is = srcPart.getInputStream()) { > > byte buf[] = new byte[1024]; > > for (int readBytes; (readBytes = is.read(buf)) != -1; > > os.write(buf, 0, readBytes)) > > os.flush(); > > ; > > } > > } > > } > > > > regards, > > Jan > > >