Skip to content

Commit 0e4f00c

Browse files
committed
GH-545 allow to share heap cache
1 parent 4e38874 commit 0e4f00c

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

visualvm/libs.profiler/lib.profiler.heap/src/org/graalvm/visualvm/lib/jfluid/heap/CacheDirectory.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,17 @@ private File lookupFile(String fileName, boolean checkParent) throws FileNotFoun
160160
if (isFileR(f)) {
161161
return f;
162162
}
163+
if (!fileName.contains(File.separator)) {
164+
// OS mismatch, try opposite separator
165+
char sep = File.separatorChar == '/' ? '\\' : '/'; // NOI18N
166+
int lastSep = fileName.lastIndexOf(sep);
167+
if (lastSep != -1) {
168+
f = new File(dir, fileName.substring(lastSep+1));
169+
if (isFileR(f)) {
170+
return f;
171+
}
172+
}
173+
}
163174
throw new FileNotFoundException(fileName);
164175
}
165176

visualvm/libs.profiler/lib.profiler.heap/src/org/graalvm/visualvm/lib/jfluid/heap/HprofHeap.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -386,7 +386,7 @@ void writeToStream(DataOutputStream out) throws IOException {
386386
}
387387
String os = dis.readUTF();
388388
if (!os.equals(System.getProperty(OS_PROP))) {
389-
throw new IOException("HPROF OS mismatch. Cached "+os+" current OS "+System.getProperty(OS_PROP));
389+
System.err.println("Warning: HPROF OS mismatch. Cached "+os+" current OS "+System.getProperty(OS_PROP));
390390
}
391391
nearestGCRoot = new NearestGCRoot(this, dis);
392392
allInstanceDumpBounds = new TagBounds(dis);

0 commit comments

Comments
 (0)