大家能獻獻高見嗎:(c++)怎麽防止吃內存?

來源: 戲雨飛鷹 2009-01-23 09:06:02 [] [博客] [舊帖] [給我悄悄話] 本文已被閱讀: 次 (87 bytes)


除了malloc/free,new/delete配對外(即:分配必須施放),還有什麽tips?

所有跟帖: 

我想整理下這方麵的東西,好在這方麵吹吹牛。 -戲雨飛鷹- 給 戲雨飛鷹 發送悄悄話 戲雨飛鷹 的博客首頁 (12 bytes) () 01/23/2009 postreply 09:09:55

你好牛 -catcherintherye- 給 catcherintherye 發送悄悄話 (29 bytes) () 01/23/2009 postreply 09:13:05

wo哪樣都不行。:) -戲雨飛鷹- 給 戲雨飛鷹 發送悄悄話 戲雨飛鷹 的博客首頁 (0 bytes) () 01/23/2009 postreply 09:15:48

把題目放大一點,pointer使用注意啥?我吃飯去了。下午見:) -戲雨飛鷹- 給 戲雨飛鷹 發送悄悄話 戲雨飛鷹 的博客首頁 (0 bytes) () 01/23/2009 postreply 09:16:21

心中很盼能獻獻,可惜木有啥高見.縱然不再吃內存,能寫寇得到幾年? -美國老土- 給 美國老土 發送悄悄話 美國老土 的博客首頁 (819 bytes) () 01/23/2009 postreply 09:32:03

飛鷹中了邪,這化石語言附體了,該跳個大神。 -竹杉林- 給 竹杉林 發送悄悄話 竹杉林 的博客首頁 (0 bytes) () 01/23/2009 postreply 09:53:27

你看你,不幫我走向牛壇就算了,還汙蔑我的看家本事~~ -戲雨飛鷹- 給 戲雨飛鷹 發送悄悄話 戲雨飛鷹 的博客首頁 (0 bytes) () 01/23/2009 postreply 10:30:03

Just learned Google, Amazon, etc are using script languages -竹杉林- 給 竹杉林 發送悄悄話 竹杉林 的博客首頁 (533 bytes) () 01/23/2009 postreply 11:48:13

C/C++ are for different things than PHP, PERL, Python, Ruby -any_mor_left- 給 any_mor_left 發送悄悄話 (92 bytes) () 01/23/2009 postreply 12:03:44

My last job was developing applications using PERL -竹杉林- 給 竹杉林 發送悄悄話 竹杉林 的博客首頁 (33 bytes) () 01/23/2009 postreply 12:20:27

估計any-mor-left此刻正忙著呢?~~。謝謝! -戲雨飛鷹- 給 戲雨飛鷹 發送悄悄話 戲雨飛鷹 的博客首頁 (0 bytes) () 01/23/2009 postreply 12:31:53

正忙著?沒有. -any_mor_left- 給 any_mor_left 發送悄悄話 (0 bytes) () 01/23/2009 postreply 12:37:30

是的是的,現在C/C++一般用在game/embedded/driver等方麵, -戲雨飛鷹- 給 戲雨飛鷹 發送悄悄話 戲雨飛鷹 的博客首頁 (186 bytes) () 01/23/2009 postreply 10:36:50

好, 我也“向飛鷹姐姐學習”。 -nopanic- 給 nopanic 發送悄悄話 (0 bytes) () 01/23/2009 postreply 17:44:26

買個附加的?不會的我都去買。 -眼冒金星- 給 眼冒金星 發送悄悄話 眼冒金星 的博客首頁 (0 bytes) () 01/23/2009 postreply 10:04:49

可這次可買不來,:) -戲雨飛鷹- 給 戲雨飛鷹 發送悄悄話 戲雨飛鷹 的博客首頁 (0 bytes) () 01/23/2009 postreply 10:39:09

回複:大家能獻獻高見嗎:(c++)怎麽防止吃內存? -sub101- 給 sub101 發送悄悄話 (48 bytes) () 01/23/2009 postreply 10:06:05

謝謝,看完了。文中給的方法都是very basic的知識。沒有超出 -戲雨飛鷹- 給 戲雨飛鷹 發送悄悄話 戲雨飛鷹 的博客首頁 (164 bytes) () 01/23/2009 postreply 10:28:05

Remove Orphans -any_mor_left- 給 any_mor_left 發送悄悄話 (0 bytes) () 01/23/2009 postreply 10:37:41

hmmm, good one. let me google about it:) thanks! -戲雨飛鷹- 給 戲雨飛鷹 發送悄悄話 戲雨飛鷹 的博客首頁 (0 bytes) () 01/23/2009 postreply 10:42:33

不僅要配對, 還要盡早釋放(一旦object 不用了, 就release.) -ExpectingMM- 給 ExpectingMM 發送悄悄話 (302 bytes) () 01/23/2009 postreply 11:33:32

thanks:) -戲雨飛鷹- 給 戲雨飛鷹 發送悄悄話 戲雨飛鷹 的博客首頁 (0 bytes) () 01/23/2009 postreply 11:56:30

use objects on stack -ncpga- 給 ncpga 發送悄悄話 (0 bytes) () 01/23/2009 postreply 12:52:41

right. -戲雨飛鷹- 給 戲雨飛鷹 發送悄悄話 戲雨飛鷹 的博客首頁 (0 bytes) () 01/23/2009 postreply 13:21:49

use singleton -ncpga- 給 ncpga 發送悄悄話 (0 bytes) () 01/23/2009 postreply 12:54:34

why? -戲雨飛鷹- 給 戲雨飛鷹 發送悄悄話 戲雨飛鷹 的博客首頁 (0 bytes) () 01/23/2009 postreply 13:21:28

here is why -ncpga- 給 ncpga 發送悄悄話 (222 bytes) () 01/23/2009 postreply 13:27:58

thanks. u r real a guru! happy new yr! -戲雨飛鷹- 給 戲雨飛鷹 發送悄悄話 戲雨飛鷹 的博客首頁 (0 bytes) () 01/23/2009 postreply 13:31:58

those are really basics -ncpga- 給 ncpga 發送悄悄話 (26 bytes) () 01/23/2009 postreply 13:56:49

haha, absolutely :) -戲雨飛鷹- 給 戲雨飛鷹 發送悄悄話 戲雨飛鷹 的博客首頁 (0 bytes) () 01/23/2009 postreply 14:14:07

use managed heap -ncpga- 給 ncpga 發送悄悄話 (0 bytes) () 01/23/2009 postreply 12:56:01

right. -戲雨飛鷹- 給 戲雨飛鷹 發送悄悄話 戲雨飛鷹 的博客首頁 (0 bytes) () 01/23/2009 postreply 13:22:49

use virtual dtor -ncpga- 給 ncpga 發送悄悄話 (0 bytes) () 01/23/2009 postreply 12:57:16

wow, wow!! thanks a lot, ncpga!!! -戲雨飛鷹- 給 戲雨飛鷹 發送悄悄話 戲雨飛鷹 的博客首頁 (0 bytes) () 01/23/2009 postreply 13:18:07

auto_ptr, STL container, RAII -就說一句- 給 就說一句 發送悄悄話 (0 bytes) () 01/23/2009 postreply 14:15:52

thanks:) -戲雨飛鷹- 給 戲雨飛鷹 發送悄悄話 戲雨飛鷹 的博客首頁 (0 bytes) () 01/23/2009 postreply 14:58:05

Check "Effective C++" by Scott Meyers -lhan- 給 lhan 發送悄悄話 (0 bytes) () 01/23/2009 postreply 22:52:30

請您先登陸,再發跟帖!

發現Adblock插件

如要繼續瀏覽
請支持本站 請務必在本站關閉/移除任何Adblock

關閉Adblock後 請點擊

請參考如何關閉Adblock/Adblock plus

安裝Adblock plus用戶請點擊瀏覽器圖標
選擇“Disable on www.wenxuecity.com”

安裝Adblock用戶請點擊圖標
選擇“don't run on pages on this domain”