diff --git a/ZE-Standard-Libraries.xcodeproj/xcuserdata/huyibing.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/ZE-Standard-Libraries.xcodeproj/xcuserdata/huyibing.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
index d16736f..f56e272 100644
--- a/ZE-Standard-Libraries.xcodeproj/xcuserdata/huyibing.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
+++ b/ZE-Standard-Libraries.xcodeproj/xcuserdata/huyibing.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
@@ -147,5 +147,37 @@
landmarkType = "9">
+
+
+
+
+
+
+
+
diff --git a/list/list_expand.c b/list/list_expand.c
index 33f21b5..287658a 100644
--- a/list/list_expand.c
+++ b/list/list_expand.c
@@ -348,4 +348,15 @@ List *m_findByStringForNode(List* p_list, char *temp) {
List *m_findByPointerForNode(List* p_list, void *temp) {
return mply_findByValue(p_list, POINTER, (void *)temp);
+}
+
+unsigned long long calListMemory(List * p_list){
+ Node *p_node = p_list->head;
+ unsigned long long nodes_size = 0LL;
+ unsigned long long list_size = sizeof(p_list);
+ while(p_node != NULL){
+ nodes_size += sizeof(p_node) + sizeof(*p_node->value);
+ p_node = p_node->next;
+ }
+ return list_size + nodes_size;
}
diff --git a/list/list_expand.h b/list/list_expand.h
index a9d210f..18ba83e 100644
--- a/list/list_expand.h
+++ b/list/list_expand.h
@@ -36,5 +36,7 @@ char *getByStringForNode(Node *);//直接得到节点的值
void *getByPointerForNode(Node *);//直接得到节点的值
unsigned long long getIndexByNode(List *p_list,Node *p_node);
int listThrough(List *p_list, int (*p_func)(int , void *));//遍历链表并不断调用目标函数。目标函数将接受节点储存值的指针及其类型。
+
+unsigned long long calListMemory(List *);
#endif
diff --git a/tree/tree_expand.c b/tree/tree_expand.c
index 0ef44a2..1f30a1f 100644
--- a/tree/tree_expand.c
+++ b/tree/tree_expand.c
@@ -211,4 +211,17 @@ int printTree(Tree *p_tree) {
printf("Tree(id: %llu)",p_tree->id);
printTNodeWithFamily(p_tree->root,0);
return 0;
-}
+}
+
+static unsigned long long tnodes_size = 0LL;
+
+unsigned long long calTreeMemory(Tree *p_tree){
+ tnodes_size = 0LL;
+ TreeThroughDown(p_tree, _doCalTreeMemory);
+ return sizeof(p_tree) + tnodes_size;
+}
+
+int _doCalTreeMemory(TNode *p_tnode, unsigned long long height){
+ tnodes_size += sizeof(p_tnode) + sizeof(*p_tnode->value);
+ return 0;
+}
diff --git a/tree/tree_expand.h b/tree/tree_expand.h
index d8d882a..a4236a2 100644
--- a/tree/tree_expand.h
+++ b/tree/tree_expand.h
@@ -17,5 +17,8 @@ int printTree(Tree *p_tree);
int printTNodeWithHome(TNode *p_tnode, int priority);
int printTNodeWithFamily(TNode *p_tnode, int priority);
int printTNode(TNode *p_tnode, int priority);
+
+unsigned long long calTreeMemory(Tree *);
+int _doCalTreeMemory(TNode *p_tnode, unsigned long long height);
#endif