MCPcopy Create free account
hub / github.com/diffplug/matfilerw / clean

Method clean

src/main/java/com/jmatio/io/MatFileReader.java:683–699  ·  view source on GitHub ↗

Workaround taken from bug #4724038 to release the memory mapped byte buffer. Little quote from SUN: This is highly inadvisable, to put it mildly. It is exceedingly dangerous to forcibly unmap a mapped byte buffer that's

(final Object buffer)

Source from the content-addressed store, hash-verified

681 * all kind of evil stuff
682 */
683 private void clean(final Object buffer) throws Exception {
684 AccessController.doPrivileged(new PrivilegedAction<Object>() {
685 public Object run() {
686 try {
687 Method getCleanerMethod = buffer.getClass().getMethod(
688 "cleaner", new Class[0]);
689 getCleanerMethod.setAccessible(true);
690 sun.misc.Cleaner cleaner = (sun.misc.Cleaner) getCleanerMethod
691 .invoke(buffer, new Object[0]);
692 cleaner.clean();
693 } catch (Exception e) {
694 e.printStackTrace();
695 }
696 return null;
697 }
698 });
699 }
700
701 /**
702 * Gets MAT-file header

Callers 2

readMethod · 0.95
runMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected