예제 #1
0
void addNodeToBST(bst_node_ptr* root, bst_node_ptr node) {
    bst_node_ptr cur;
    memory_debug("addNodeToBST: category %d", node->category);
    if (*root == NULL) {
        *root = node;
        return;
    }
    cur = *root;
    while (1) {
        if (node->start > cur->start) {
            if (cur->right != NULL) {
                cur = cur->right;
            } else {
                cur->right = node;
                break;
            }
        } else {
            if (cur->left != NULL) {
                cur = cur->left;
            } else {
                cur->left = node;
                break;
            }
        } /* end  of if*/
    } /* end of while*/

}
예제 #2
0
void deinit_memory_manage() {
    chunk_ptr tmp_chunk;
    block_ptr tmp_block;
    int i;
    /* free chunks*/
    memory_loginfo("free chunks");
    lockMemoryGlobalInfo();
    while (g_memory_info->chunk_list) {
        tmp_chunk = g_memory_info->chunk_list;
        g_memory_info->chunk_list = tmp_chunk->next;
        free(tmp_chunk->addr);
        free(tmp_chunk);
    }
    /* free bst*/
    memory_loginfo("free bst");
    destroyBST(g_memory_info->category_map_BST);
    /* free free block chain*/
    memory_loginfo("free free block chain");
    for (i = 0; i < CATEGORY_NUM; i ++) {
        memory_debug("free category %d free block chain", i);
        while (g_memory_info->free_block_chains[i]) {
            tmp_block = g_memory_info->free_block_chains[i];
            g_memory_info->free_block_chains[i] = tmp_block->next;
            free(tmp_block);
        }
    }
    free(g_memory_info);
    g_memory_info = NULL;
    memory_loginfo("deinit successed");
    unlockMemoryGlobalInfo();
    destroyMemoryGlobalInfoLock();
}
예제 #3
0
memo_category findCategoryInBST(bst_node_ptr root, addr_type addr, \
        addr_type* base) {
    bst_node_ptr cur = root;
    memory_debug("findCategoryInBST");
    while (cur) {
        memory_debug("findCategoryInBST: category %d", cur->category);
        if (addr >= cur->start && addr <= cur->end) {
            *base = cur->start;
            return cur->category;
        }
        if (addr < cur->start) {
            cur = cur->left;
        } else {
            cur = cur->right;
        }
    }
    return NIL;
}
예제 #4
0
파일: message.c 프로젝트: wangzh/ikgt-usage
void handle_msg_debug(ikgt_event_info_t *event_info, debug_message_t *msg)
{
	memory_debug(msg->parameter);

	cpu_debug(msg->parameter);

	policy_debug(event_info, msg);

	log_debug(msg->parameter);
}
예제 #5
0
파일: shell.cpp 프로젝트: imzacm/thor-os
void memorydebug_command(const std::vector<std::string>&){
    memory_debug();
}