Permalink
Browse files

run ok

  • Loading branch information...
1 parent 2a4bf66 commit 4c0d4ea791ef3b32c3d59650238c2ec1cbd72598 @Yemsheng committed Sep 22, 2012
View
@@ -100,7 +100,8 @@ char* BuddyMem::BuddyMemMalloc(const unsigned int size)
LinkNode *usedNode = new LinkNode;
usedNode->address = pAlloc;
usedNode->next = NULL;
- insertNodeToTableLinkList(m_usedTableLinkListArray,tableIndex,usedNode);
+ //insertNodeToTableLinkList(m_usedTableLinkListArray,tableIndex,usedNode);
+ insertNodeToUsedableLinkList(tableIndex, usedNode);
//3、从链表头节点保存的内存空间拆分成新的节点,添加到empty表
int i = 0;
@@ -111,7 +112,8 @@ char* BuddyMem::BuddyMemMalloc(const unsigned int size)
emptyNode = new LinkNode;
emptyNode->address = pInsert;
emptyNode->next = NULL;
- insertNodeToTableLinkList(m_emptyTableLinkListArray,i,emptyNode);
+ //insertNodeToTableLinkList(m_emptyTableLinkListArray,i,emptyNode);
+ insertNodeToEmptyTableLinkList(i, emptyNode);
pInsert = pInsert + m_blockSize*getBlockAmountFromIndex(i);
}
@@ -152,7 +154,8 @@ void BuddyMem::BuddyMemFree(char *pMem)
nodeFind->next = NULL;
memset(nodeFind->address, 0, m_blockSize*getBlockAmountFromIndex(index));
//把该节点插入empty表中
- insertNodeToTableLinkList(m_emptyTableLinkListArray,index,nodeFind);
+ //insertNodeToTableLinkList(m_emptyTableLinkListArray,index,nodeFind);
+ insertNodeToEmptyTableLinkList(index, nodeFind);
}
View
Binary file not shown.
View
Binary file not shown.
View
@@ -6,22 +6,22 @@
--------------------Configuration: BuddyMem - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
-Creating temporary file "H:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP152.tmp" with contents
+Creating temporary file "H:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP193.tmp" with contents
[
/nologo /MLd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR"Debug/" /Fp"Debug/BuddyMem.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c
-"E:\project\BuddyMem\main.cpp"
+"E:\project\BuddyMem\BuddyMem.cpp"
]
-Creating command line "cl.exe @H:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP152.tmp"
-Creating temporary file "H:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP153.tmp" with contents
+Creating command line "cl.exe @H:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP193.tmp"
+Creating temporary file "H:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP194.tmp" with contents
[
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:yes /pdb:"Debug/BuddyMem.pdb" /debug /machine:I386 /out:"Debug/BuddyMem.exe" /pdbtype:sept
.\Debug\BuddyMem.obj
.\Debug\main.obj
]
-Creating command line "link.exe @H:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP153.tmp"
+Creating command line "link.exe @H:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP194.tmp"
<h3>Output Window</h3>
Compiling...
-main.cpp
+BuddyMem.cpp
Linking...
Creating command line "bscmake.exe /nologo /o"Debug/BuddyMem.bsc" .\Debug\BuddyMem.sbr .\Debug\main.sbr"
Creating browse info file...
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
@@ -11,8 +11,8 @@ int main()
buddyMem.BuddyMemCreate();
char *p1 = buddyMem.BuddyMemMalloc(3);
buddyMem.BuddyMemFree(p1);
- char *p2 = buddyMem.BuddyMemMalloc(33);
- char *p3 = buddyMem.BuddyMemMalloc(33);
+ //char *p2 = buddyMem.BuddyMemMalloc(33);
+ //char *p3 = buddyMem.BuddyMemMalloc(33);
buddyMem.BuddyMemDestroy();
return 0;

0 comments on commit 4c0d4ea

Please sign in to comment.