File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 2525
2626// ATTENTION !!!!!!
2727// You can modify this to match your computer.
28- #define MEM_SIZE (1*GB+500 *MB)
28+ #define MEM_SIZE (1*GB+50 *MB)
2929#define DATA_N 20000000
3030
3131#define uint unsigned int
@@ -44,13 +44,14 @@ uint random_uint(uint maxn)
4444
4545int main ()
4646{
47+ _init ();
4748 // -------- clock start ---------
4849 clock_t start , finish ;
4950 double total_time ;
5051 start = clock ();
5152 // -------- clock start ----------
5253#ifdef _z_memorypool_h_
53- mem_size_t total_size = 0 , cur_size = 0 , cnt = 0 ;
54+ mem_size_t total_size = 0 , cur_size = 0 ;
5455#else
5556 unsigned long long total_size = 0 , cur_size = 0 , cnt = 0 ;
5657#endif
@@ -70,21 +71,19 @@ int main()
7071 SHOW ("Alloc Before: \n" );
7172#endif
7273
73- total_size = 0 ; cnt = 0 ;
74+ total_size = 0 ;
7475 for (int j = 0 ; j < DATA_N ; ++ j )
7576 {
7677 cur_size = random_uint (200 );
7778 total_size += cur_size ;
78- if (total_size >= MEM_SIZE ) break ;
7979 mem [j ] = My_Malloc (cur_size );
80- cnt ++ ;
8180 }
8281
8382#ifdef _z_memorypool_h_
8483 SHOW ("Free Before: \n" );
8584#endif
8685
87- for (int j = 0 ; j < cnt ; ++ j )
86+ for (int j = 0 ; j < DATA_N ; ++ j )
8887 My_Free (mem [j ]);
8988 // MemoryPool_Clear(mp);
9089
You can’t perform that action at this time.
0 commit comments