1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 14:12:10 +02:00

[262680] [memory] OutOfMemory exception in traditional rendering

This commit is contained in:
Ted Williams 2009-03-14 06:00:46 +00:00
parent 25b0ee6d2e
commit 76dff04194

View file

@ -859,12 +859,12 @@ public class Rendering extends Composite implements IDebugEventSetListener
{ {
try try
{ {
final IMemoryBlockExtension memoryBlock = getMemoryBlock(); IMemoryBlockExtension memoryBlock = getMemoryBlock();
final BigInteger lengthInBytes = endAddress.subtract(startAddress); BigInteger lengthInBytes = endAddress.subtract(startAddress);
final BigInteger addressableSize = BigInteger.valueOf(getAddressableSize()); BigInteger addressableSize = BigInteger.valueOf(getAddressableSize());
final long units = lengthInBytes.divide(addressableSize).add( long units = lengthInBytes.divide(addressableSize).add(
lengthInBytes.mod(addressableSize).compareTo(BigInteger.ZERO) > 0 lengthInBytes.mod(addressableSize).compareTo(BigInteger.ZERO) > 0
? BigInteger.ONE : BigInteger.ZERO).longValue(); ? BigInteger.ONE : BigInteger.ZERO).longValue();
@ -873,8 +873,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
// change history. Ideally, we should strictly use the back end change notification // change history. Ideally, we should strictly use the back end change notification
// and history, but it is only guaranteed to work for bytes within the address range // and history, but it is only guaranteed to work for bytes within the address range
// of the MemoryBlock. // of the MemoryBlock.
final MemoryByte readBytes[] = memoryBlock MemoryByte readBytes[] = memoryBlock.getBytesFromAddress(startAddress, units);
.getBytesFromAddress(startAddress, units);
TraditionalMemoryByte cachedBytes[] = new TraditionalMemoryByte[readBytes.length]; TraditionalMemoryByte cachedBytes[] = new TraditionalMemoryByte[readBytes.length];
for(int i = 0; i < readBytes.length; i++) for(int i = 0; i < readBytes.length; i++)
@ -907,6 +906,12 @@ public class Rendering extends Composite implements IDebugEventSetListener
} }
final TraditionalMemoryByte[] cachedBytesFinal = cachedBytes; final TraditionalMemoryByte[] cachedBytesFinal = cachedBytes;
fCache = new MemoryUnit();
fCache.start = startAddress;
fCache.end = endAddress;
fCache.bytes = cachedBytesFinal;
Display.getDefault().asyncExec(new Runnable() Display.getDefault().asyncExec(new Runnable()
{ {
public void run() public void run()
@ -944,11 +949,6 @@ public class Rendering extends Composite implements IDebugEventSetListener
} }
} }
fCache = new MemoryUnit();
fCache.start = startAddress;
fCache.end = endAddress;
fCache.bytes = cachedBytesFinal;
// If the history does not exist, populate the history with the just populated cache. This solves the // If the history does not exist, populate the history with the just populated cache. This solves the
// use case of 1) connect to target; 2) edit memory before the first suspend debug event; 3) paint // use case of 1) connect to target; 2) edit memory before the first suspend debug event; 3) paint
// differences in changed color. // differences in changed color.