コード例 #1
0
ファイル: MemoryAlloc.py プロジェクト: bopopescu/AGSImager
 def dump_mem_state(self):
     chunk = self.free_first
     num = 0
     while chunk != None:
         log_mem_alloc.debug("dump #%02d: %s" % (num, chunk))
         num += 1
         chunk = chunk.next
コード例 #2
0
ファイル: MemoryAlloc.py プロジェクト: kyberias/amitools
 def dump_mem_state(self):
     chunk = self.free_first
     num = 0
     while chunk != None:
         log_mem_alloc.debug("dump #%02d: %s" % (num, chunk))
         num += 1
         chunk = chunk.next
コード例 #3
0
ファイル: MemoryAlloc.py プロジェクト: bopopescu/AGSImager
    def free_mem(self, addr, size):
        # first check if its a right alloc
        if not self.addrs.has_key(addr):
            raise VamosInternalError("Invalid Free'd Memory at %06x" % addr)
        real_size = self.addrs[addr]
        # remove from valid allocs
        del self.addrs[addr]
        # create a new free chunk
        chunk = MemoryChunk(addr, real_size)
        self._insert_chunk(chunk)

        # try to merge with prev/next
        prev = chunk.prev
        if prev != None:
            new_chunk = self._merge_chunk(prev, chunk)
            if new_chunk != None:
                log_mem_alloc.debug("merged: %s + this=%s -> %s", prev, chunk,
                                    new_chunk)
                chunk = new_chunk
        next = chunk.next
        if next != None:
            new_chunk = self._merge_chunk(chunk, next)
            if new_chunk != None:
                log_mem_alloc.debug("merged: this=%s + %s -> %s", chunk, next,
                                    new_chunk)

        # correct free bytes
        self.free_bytes += size
        num_allocs = len(self.addrs)
        log_mem_alloc.info("[free  @%06x-%06x: %06x bytes] %s", addr,
                           addr + size, size, self._stat_info())
コード例 #4
0
ファイル: MemoryAlloc.py プロジェクト: kyberias/amitools
    def free_mem(self, addr, size):
        # first check if its a right alloc
        if not self.addrs.has_key(addr):
            raise VamosInternalError("Invalid Free'd Memory at %06x" % addr)
        real_size = self.addrs[addr]
        # remove from valid allocs
        del self.addrs[addr]
        # create a new free chunk
        chunk = MemoryChunk(addr, real_size)
        self._insert_chunk(chunk)

        # try to merge with prev/next
        prev = chunk.prev
        if prev != None:
            new_chunk = self._merge_chunk(prev, chunk)
            if new_chunk != None:
                log_mem_alloc.debug("merged: %s + this=%s -> %s", prev, chunk, new_chunk)
                chunk = new_chunk
        next = chunk.next
        if next != None:
            new_chunk = self._merge_chunk(chunk, next)
            if new_chunk != None:
                log_mem_alloc.debug("merged: this=%s + %s -> %s", chunk, next, new_chunk)

        # correct free bytes
        self.free_bytes += size
        num_allocs = len(self.addrs)
        log_mem_alloc.info("[free  @%06x-%06x: %06x bytes] %s", addr, addr + size, size, self._stat_info())