Re: C out-of-bound pointer question

看板FB_chat作者時間18年前 (2007/11/16 22:03), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串4/4 (看更多)
Oliver Fromme <olli@lurza.secnetix.de> writes: > It is true that the k[] array in v2.0 uses 1 GB of mapped memory, > *BUT* it does not use 1 GB of RAM. It only uses one page of physical > RAM. Remember that RAM is allocated dynamically when it is accessed > for the first time, so if you never access k[0..268435409], then no > RAM will be allocated for it. Of course, you should make sure that it > is a local variable (or a malloc()ed one) that is not initialized, or > otherwise the initialization will cause RAM to be allocated. Make > sure you initialize only the indices that you need. It can't be a local variable; it's larger than the stack. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no _______________________________________________ freebsd-chat@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-chat To unsubscribe, send any mail to "freebsd-chat-unsubscribe@freebsd.org"
文章代碼(AID): #17FQD300 (FB_chat)
文章代碼(AID): #17FQD300 (FB_chat)