mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-02 05:45:58 +02:00
Only call System.gc() on Dispose if sections have been mapped.
This commit is contained in:
parent
8421cfe986
commit
81281de742
1 changed files with 6 additions and 3 deletions
|
@ -49,6 +49,7 @@ public class Elf {
|
||||||
private Section symtab_sym;
|
private Section symtab_sym;
|
||||||
private Symbol[] dynsym_symbols;
|
private Symbol[] dynsym_symbols;
|
||||||
private Section dynsym_sym;
|
private Section dynsym_sym;
|
||||||
|
private boolean sections_mapped; // Have sections been mapped? Used to clean up properly in Elf.Dispose.
|
||||||
|
|
||||||
protected String EMPTY_STRING = ""; //$NON-NLS-1$
|
protected String EMPTY_STRING = ""; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@ -339,6 +340,7 @@ public class Elf {
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
*/
|
*/
|
||||||
public ByteBuffer mapSectionData() throws IOException {
|
public ByteBuffer mapSectionData() throws IOException {
|
||||||
|
sections_mapped = true;
|
||||||
return efile.getChannel().map(MapMode.READ_ONLY, sh_offset, sh_size).load().asReadOnlyBuffer();
|
return efile.getChannel().map(MapMode.READ_ONLY, sh_offset, sh_size).load().asReadOnlyBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,7 +439,7 @@ public class Elf {
|
||||||
|
|
||||||
private String name = null;
|
private String name = null;
|
||||||
|
|
||||||
private Section sym_section;
|
private final Section sym_section;
|
||||||
|
|
||||||
public Symbol(Section section) {
|
public Symbol(Section section) {
|
||||||
sym_section = section;
|
sym_section = section;
|
||||||
|
@ -606,7 +608,7 @@ public class Elf {
|
||||||
public final static int DT_RPATH = 15;
|
public final static int DT_RPATH = 15;
|
||||||
public long d_tag;
|
public long d_tag;
|
||||||
public long d_val;
|
public long d_val;
|
||||||
private Section section;
|
private final Section section;
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
protected Dynamic(Section section) {
|
protected Dynamic(Section section) {
|
||||||
|
@ -954,6 +956,7 @@ public class Elf {
|
||||||
efile = null;
|
efile = null;
|
||||||
|
|
||||||
// ensure the mappings get cleaned up
|
// ensure the mappings get cleaned up
|
||||||
|
if (sections_mapped)
|
||||||
System.gc();
|
System.gc();
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue