大家能献献高见吗:(c++)怎么防止吃内存?



除了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

请您先登陆,再发跟帖!