维生素C.net
Talents come from diligence, and knowledge is gained by accumulation 天才源于勤奋,知识源于积累。
难忘的1654天
博客园  首页  新随笔  新文章  联系  管理  订阅 订阅
随笔- 220  文章- 1  评论- 1645 
不知道多少人存在这个误解:
  1. When the script engine is shut down, garbage is collected.
  2. When 256 variants, or more than 64KB of strings, or more than 4096 array slots have been allocated, the garbage collector sets a flag that says collect soon.
  3. Whenever a new statement is executed or the script debugger starts, that flag is checked, and if it is set, a collection is done.

看到这篇帖子的朋友不知道有多少人看过上面三条规则,如果你从搜索引擎搜索javascript delete object的话会经常看到上面这三条,但是这3条规则其实是针对Jscript的,跟javascript没有关系的

全文:

JScript
uses a mark-and-sweep garbage collector with a variety of heuristics used to determine when to run garbage collection. The JScript garbage collector works like this:

There is an undocumented JScript function called CollectGarbage that forces a garbage collection. This is for testing purposes only—do not ship code that calls this function. It is a poor programming practice to write code in JScript that depends on garbage collections being done at particular times. If you need predictable garbage collection, use a language that supports it (like Visual Basic® or VBScript). Note that all of this is the implementation detail of the engine and should not be relied upon because it may change in the future. Note also that the version of JScript supported by Microsoft® .NET will use the .NET Framework garbage collector, a multigenerational mark-and-sweep collector.
And remember, if you want a deterministic-lifetime app, use a deterministic-lifetime language like C++, Visual Basic 6.0, or VBScript; not an indeterministic-lifetime language like JScript, Scheme, or Java. If you're writing a program that depends on being able to have a deterministic object lifetime, JScript is not the right tool for the job. Trying to make it a deterministic-lifetime language will just create headaches down the road.

posted on 2007-12-27 10:39 维生素C.NET 阅读(466) 评论(0)  编辑 收藏
新用户注册  刷新评论列表  

标题  
姓名  
主页
Email (博主才能看到) 
验证码 *  看不清,换一张 [登录][注册]
内容(请不要发表任何与政治相关的内容)  
  博客园首页

  新闻频道

  社区

  小组

  博问

  网摘

  闪存

  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      
该文被作者在 2007-12-27 17:52 编辑过
成果网帮您增加网站收入

相关文章:
你所不知道的多普达Dopod!!![565配件维修价格曝光]
今天不知道写什么
你可能已经知道或者不知道的ASP.NET 2.0技巧
不知道“开源的定义”的来补补课
[浅谈 演示] 你所不知道的HTML - 从 XHTML2 到 HTML5 (1)
C#几种常见误解

相关链接:

历史上的今天:
2004-12-27 10 Tips for Writing High-Performance Web Applications
2004-12-27 Microsoft "Indigo" Frequently Asked Questions

最新IT新闻:
JavaScript将成Silverlight的最大对手?
没有谷歌就活不下去的四个网站
Google 10周岁生日
祝Google 10周岁生日快乐
Google十年市值达1500亿美元 创造奇迹
 



公告

view my mvp profile 看看有多少人来访问我的Blog了!
hotmail

<2007年12月>
日一二三四五六
2526272829301
2345678
9101112131415
16171819202122
23242526272829
303112345

与我联系

  • 发短消息

搜索

 

常用链接

  • 我的随笔
  • 我的空间
  • 我的短信
  • 我的评论
  • 更多链接
  • 我的参与
  • 我的新闻
  • 最新评论
  • 我的标签

留言簿(168)

  • 给我留言
  • 查看留言

我参与的团队

  • 北京.NET俱乐部(0/1483)
  • 烟台.NET俱乐部(0/47)
  • ASP.NET AJAX (Atlas)学习(0/1347)
  • MVP(微软最有价值专家)团队(0/568)
  • 博客园培训团队(0/111)
  • Silverlight学习与研究(0/286)
  • CLR基础研究团队(0/387)

随笔分类(148)

  • ASP.NET(26)
  • Code Warehouse(20)
  • IronRuby,DLR(2)
  • LINQ(3)
  • Reading(3)
  • Training@cnblogs(23)
  • Ubuntu(4)
  • Windows Live(6)
  • Windows Mobile(7)
  • XHTML & Web Standard(54)

随笔档案(220)

  • 2008年3月 (2)
  • 2008年1月 (3)
  • 2007年12月 (3)
  • 2007年9月 (1)
  • 2007年8月 (2)
  • 2007年7月 (3)
  • 2007年6月 (3)
  • 2007年3月 (4)
  • 2007年2月 (3)
  • 2007年1月 (1)
  • 2006年12月 (1)
  • 2006年11月 (8)
  • 2006年10月 (6)
  • 2006年9月 (11)
  • 2006年8月 (5)
  • 2006年7月 (4)
  • 2006年6月 (1)
  • 2006年5月 (10)
  • 2006年4月 (8)
  • 2006年2月 (2)
  • 2006年1月 (1)
  • 2005年12月 (11)
  • 2005年11月 (13)
  • 2005年10月 (3)
  • 2005年9月 (1)
  • 2005年8月 (4)
  • 2005年7月 (3)
  • 2005年6月 (4)
  • 2005年4月 (5)
  • 2005年3月 (10)
  • 2005年2月 (7)
  • 2005年1月 (28)
  • 2004年12月 (15)
  • 2004年11月 (10)
  • 2004年10月 (5)
  • 2004年9月 (1)
  • 2004年6月 (13)
  • 2004年5月 (5)

文章档案(1)

  • 2005年5月 (1)

相册

  • ASPNET2tutorial
  • BlogUsing
  • My love and my friends
  • newGallery
  • 下一代网络图片

.net网站收藏

  • ASP.NET2.0 Tutorial
  • CodeBetter.com
  • F#
  • IIS.net
  • MS NewsGroup
  • NewsGroups
  • OnlyVC.org
  • VWD2005GuidedTour
  • ZDNet China软件技术专区

OSS 2007

  • Charsh
  • Kaneboy
  • Official Team Blog

Python

  • BeginnersGuide

好友的BLOG

  • DemoFox@JoyCode
  • DflyingChen
  • dudu
  • EricLee
  • hbifts
  • idior
  • Jesee Qing
  • Lion
  • Rickie
  • Samuel
  • Steph`s Website
  • 翱翔.Net
  • 陈敬熙
  • 发条木偶
  • 葛涵涛
  • 古道风
  • 寒枫天伤
  • 老猫の理想
  • 刘老师
  • 刘彦博
  • 吕震宇
  • 木野狐
  • 佘广
  • 王sir
  • 小涛
  • 小新
  • 肖老师
  • 旋哥

积分与排名

  • 积分 - 395314
  • 排名 - 53

最新评论

  • 1. re: .NET Beginner Training Step by Step开始启动
  • 早班加入
  • --石牌村夫
  • 2. re: .NET Beginner Training Step by Step开始启动
  • 申请加入!谢谢!
  • --童话@混子
  • 3. re: .NET Beginner Training Step by Step开始启动
  • 申请加入
  • --Winston
  • 4. re: .NET Beginner Training Step by Step开始启动
  • 申请加入
  • --Birdshover
  • 5. re: .NET Beginner Training Step by Step开始启动
  • 喜欢没有理由!
    申请加入
  • --倔强

阅读排行榜

  • 1. 英文名字及含义(25207)
  • 2. SQL Server 2005 Remote Access(15040)
  • 3. Visual Studio 2005 Team Edition和SQL Server 2005的下载(14319)
  • 4. Windows Installer 3.1(11487)
  • 5. Visual Studio 2005 Professional Released(10949)

评论排行榜

  • 1. .NET Beginner Training Step by Step开始启动(319)
  • 2. Windows Live Messenger 8.0 Beta 的邀请(100)
  • 3. 加入[ 下一代网络web技术(Next Generation Web Application)团队Blog ](88)
  • 4. 博客园新手.net技术培训活动(55)
  • 5. 为什么在vista上做开发?(54)
Copyright ©2008 维生素C.NET