|
|
|
|
|
|
g****y 发帖数: 436 | 1 源代码就是一个2d数组的分配和删除:
编译运行以后发现,程序占用内存按照 4K/单位时间 的速度增加,请问这是怎么回事
呢?
#include
#include
int main()
{
while(1){
int i; /* general purpose variable used for loop index */
int j; /* general purpose variable used for loop index */
int **a; /* this is the array name */
int size_x; /* this variable will be used for the first dimension */
int size_y; /* this variable will be used for the second dimension */
/* suppose we want an array of int: a[5][3] */
size_x = | g****y 发帖数: 436 | 2 下面这个代码更能说明问题,内存占用上升到了几百M
#include
#include
int main()
{
int gaga = 10000000;
while(gaga-- > 0){
int i; /* general purpose variable used for loop index */
int j; /* general purpose variable used for loop index */
int **a; /* this is the array name */
int size_x; /* this variable will be used for the first dimension */
int size_y; /* this variable will be used for the second dimension */
/* suppose we want an array of int: a[5][3] */
size_x =
【在 g****y 的大作中提到】 : 源代码就是一个2d数组的分配和删除: : 编译运行以后发现,程序占用内存按照 4K/单位时间 的速度增加,请问这是怎么回事 : 呢? : #include : #include : int main() : { : while(1){ : int i; /* general purpose variable used for loop index */ : int j; /* general purpose variable used for loop index */
| t******r 发帖数: 88 | 3
~~~~~~shit...幸好你的size_y < size_x
回事
【在 g****y 的大作中提到】 : 下面这个代码更能说明问题,内存占用上升到了几百M : #include : #include : int main() : { : int gaga = 10000000; : while(gaga-- > 0){ : int i; /* general purpose variable used for loop index */ : int j; /* general purpose variable used for loop index */ : int **a; /* this is the array name */
| h**c 发帖数: 2376 | 4 呵呵
【在 t******r 的大作中提到】 : : ~~~~~~shit...幸好你的size_y < size_x : 回事
|
|
|
|
|
|
|