public void free(SysMemInfo info) { if (info != null) { info.free(); MemoryChunk memoryChunk = new MemoryChunk(info.addr, info.allocatedSize); freeMemoryChunks[info.partitionid].add(memoryChunk); if (log.isDebugEnabled()) { log.debug(String.format("free %s", info.toString())); if (log.isTraceEnabled()) { log.trace("Free list after free: " + getDebugFreeMem()); log.trace("Allocated blocks after free:\n" + getDebugAllocatedMem() + "\n"); } } } }
public String getDebugAllocatedMem() { StringBuilder result = new StringBuilder(); // Sort allocated blocks by address List<SysMemInfo> sortedBlockList = Collections.list(Collections.enumeration(blockList.values())); Collections.sort(sortedBlockList); for (SysMemInfo sysMemInfo : sortedBlockList) { if (result.length() > 0) { result.append("\n"); } result.append(sysMemInfo.toString()); } return result.toString(); }