Helen looked straight up at the sky as if a lost memory or thought of some kind was coming back to her.
VOA: special.2009.11.08
You double click an icon, the program gets loaded into memory, well, conceptually where does your program end up?
双击一个图标,程序就被加载到内存中,那么,程序在哪里结束?
Like, um, in our Psych. class, we set up an experiment to study how memory works,
嗯,我们在心理班做一个实验,研究记忆是怎么运行的,
How can you write an original poem when your literary consciousness is essentially made up of the memory of all the things that you've read before?
你怎么能说自己写的是原创的诗,当你的文思,主要是由你以前阅读积累下的记忆,组合成的呢?
No, I think somebody had to make up a story, but the memory of kings was not of a Tarquinius.
我想总有人得编故事,而这传说中的国王并非一个,"塔克文"式的
I've been using the blackboard a little ad hoc here, but suppose I neaten things up here now and present this rectangle is let's say R RAM, the memory inside of your computer.
我在这里特别地使用这块黑板,假如我整理这些东西,把它们呈现,这个长方形,假如说就是内存,你电脑的内存。
And by that, I mean, not how much memory do I need to store the size of the input, it's really how much internal memory do I use up as I go through the computation?
需要占用多少内存,我意思并不是,存储输入需要多少内存,而是当我完成这个?
Now, if I've asked the user for a string and then a moment later I ask the user for another string, well, they're going to end up in different locations in memory just by nature of get string.
现在,如果我要用户输入一个字符串,一会儿之后我要用户输入另一个字符串,他们最终是在,不同的内存地址中。
Now I don't know what the locations are so let's just arbitrarily come up with some memory addresses.
现在我不知道那个地址是什么,让我们任意的采用一些地址。
Which may take up some arbitrary amount of memory. In that case, I'm back to this problem.
然后将接下来的每一个内存块设置为,指向数组对应元素值的指针。
Now if you call a function, swap like increment or cube or swap, or in this case, foo, those variables are the parameters to that function, end up getting stored next in memory.
现在如果你调用一个函数,像increment或者cube或者,或者在这个例子里,foo,这些变量都是,函数的参数,在内存中存储。
Almost everyone in this room has probably had a segfault at some point or core dump where you end up with this random file called core, which recall is just the contents of memory at the time your program crashed.
几乎这个教室里的所有人,在某个时候,都遇到过段错误,或者通过这个core文件的,存储器内核更新,这就是你的内存出现错误,你的程序崩溃掉了。
And one of the ways you can make a program crash, intentionally or not, is to essentially use up too much memory or call too many functions and what happens is, bam, one hits the other and bad things happen.
其中一个方式能使你的程序崩溃掉,有意或无意的,它本质上使用了太多的内存,或者调用了太多的函数,所发生的,崩掉,一个冲突了另一个,然后发生了坏事情。
I mean, you grew up in an age when computers were blazingly fast, and have tons of memory, so why in the world do you care about efficiency?
我的意思是你们是伴随着,计算机快速发展成长的,计算机都有这么大的内存,那还在乎效率干嘛呢?
You just forget where the memory is that you asked for on the heap and it's not going to get cleaned up on the stack because malloc puts it somewhere else.
你忘了你在堆中申请的内存在哪里,它将会被栈清除,因为malloc把它放在别的地方。
应用推荐