当前位置: 首页 > news >正文

跨境独立站有哪些技术教程优化搜索引擎整站

跨境独立站有哪些,技术教程优化搜索引擎整站,付费文章 wordpress,黄石网站建设推荐1、垃圾回收器GC GC(Garbage Collection)是.NET中的垃圾回收器。以应用程序的root为基础,遍历应用程序在Heap上动态分配的所有对象,通过识别它们是否被引用,来确定哪些对象是已经死亡的,哪些仍需要被使用。已经不再被…

1、垃圾回收器GC

GC(Garbage Collection)是.NET中的垃圾回收器。以应用程序的root为基础,遍历应用程序在Heap上动态分配的所有对象,通过识别它们是否被引用,来确定哪些对象是已经死亡的,哪些仍需要被使用。已经不再被应用程序的root或者别的对象所引用的对象就是已经死亡的对象,即所谓的垃圾,需要被回收。GC的开销通常很大,而且它的运行具有不确定性,微软的编程规范里是强烈建议你不要显式调用GC。但你的代码中还是可以使用.NET Framework中GC的某些方法进行手动回收,前提是必须要深刻理解GC的回收原理,否则手动调用GC在特定场景下很容易干扰到GC的正常回收甚至引入不可预知的错误。

在.NET Framework中,创建对象所用内存在托管堆中分配,垃圾管理器负责管理。在堆中可分配的内存,被CLR以块划分,以代[Gemeration]命名,初始分为256k、2M和10M三个代(0、1和2)。并且CLR可以动态调整代的大小。在堆创建的每一个对象都有一个Generation的属性。.NET Framework中约定,最近创建的对象,其Generation其值为0。创建时间越远代数越高。

强制垃圾回收用函数GC.Collect()GC.Collect(int32)参考为Generation,代码如下,

using System; 
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;namespace ConsoleApplication
{public class TestObject {public int Value = 100;public string Key = "cjavapy";}class Program{static void Main(string[] args){TestObject obj  =   new  TestObject();int  generation  =   0 ;generation  =  GC.GetGeneration(obj);Console.WriteLine(0);Console.WriteLine( " TotalMemory:{0} " , GC.GetTotalMemory( false ));Console.WriteLine( " MaxGeneration:{0} " , GC.MaxGeneration);Console.WriteLine( " Value:{0},Key:{1} " , obj.Value, obj.Key.Length);Console.WriteLine( " Generation:{0} " , generation);Console.WriteLine();try{new FileStream(@"F:\cavapy.avi", FileMode.Open);}catch  (Exception e) { }for  ( int  j  =   1 ; j  <   6 ; j ++ ){generation  =  GC.GetGeneration(obj);Console.WriteLine(j.ToString());Console.WriteLine( " TotalMemory:{0} " , GC.GetTotalMemory( false ));Console.WriteLine( " MaxGeneration:{0} " , GC.MaxGeneration);Console.WriteLine( " Value:{0},Key:{1} " , obj.Value, obj.Key.Length);Console.WriteLine( " Generation:{0} " , generation);Console.WriteLine();GC.Collect();GC.WaitForPendingFinalizers();}Console.ReadKey();  }}
}

 

2、析构函数(Finalize 方法)

析构函数(Finalize 方法)用来释放非托管资源,由GC来调用执行回收,来保证非托管资源可以被释放。Object.Finalize()方法是无法重载的,编译器是根据类的析构函数来自动生成Object.Finalize()方法的。对于包含非托管资源的类,可以将释放非托管资源的代码放在析构函数。

例如,

public class FinalizeClass
{~FinalizeClass(){//在这里,清理非托管资源}
}

 

注意:不能在析构函数中释放托管资源,因为析构函数是由垃圾回收器调用的,可能在析构函数调用之前,类包含的托管资源已经被回收了,从而导致无法预知的结果。

3、Dispose

.NET Framework中非托管理资源的释放,除了可以使用析构函数(Finalize 方法),还可以通过实现IDisposable接口,代码执行完成后通过调用Dispose()方法来释放非托管资源。与析构函数的区别主要是,Dispose()方法需要程序员手动调用。

调用方式如下,

//方式1:显示接口调用
SomeType st1=new SomeType();
//执行操作
st1.Dispose();//方式2:using()语法,运行到using范围外自动执行Dispose方法
using (var st2 = new SomeType())
{//执行操作
}

 


文章转载自:
http://dancing.xsfg.cn
http://trigraph.xsfg.cn
http://condemned.xsfg.cn
http://sightseer.xsfg.cn
http://buzkashi.xsfg.cn
http://rotatory.xsfg.cn
http://pluto.xsfg.cn
http://examination.xsfg.cn
http://electroplating.xsfg.cn
http://unostentatious.xsfg.cn
http://imperialize.xsfg.cn
http://maun.xsfg.cn
http://vinegarroon.xsfg.cn
http://compress.xsfg.cn
http://nonsked.xsfg.cn
http://vishnu.xsfg.cn
http://phylogeny.xsfg.cn
http://boxlike.xsfg.cn
http://anodize.xsfg.cn
http://langouste.xsfg.cn
http://saloon.xsfg.cn
http://forwards.xsfg.cn
http://metalmark.xsfg.cn
http://foliiferous.xsfg.cn
http://thermodynamic.xsfg.cn
http://hydrasorter.xsfg.cn
http://trudgen.xsfg.cn
http://dreggy.xsfg.cn
http://dwarf.xsfg.cn
http://eucyclic.xsfg.cn
http://dobie.xsfg.cn
http://sialadenitis.xsfg.cn
http://dubitatively.xsfg.cn
http://nebbish.xsfg.cn
http://pincers.xsfg.cn
http://kcmg.xsfg.cn
http://heyday.xsfg.cn
http://aspuint.xsfg.cn
http://accumulation.xsfg.cn
http://objurgation.xsfg.cn
http://allowedly.xsfg.cn
http://kneesie.xsfg.cn
http://convectional.xsfg.cn
http://rooseveltism.xsfg.cn
http://stenciler.xsfg.cn
http://boob.xsfg.cn
http://iranair.xsfg.cn
http://slopehead.xsfg.cn
http://mistle.xsfg.cn
http://delphic.xsfg.cn
http://idolatrous.xsfg.cn
http://natalian.xsfg.cn
http://lawlike.xsfg.cn
http://teardrop.xsfg.cn
http://goyische.xsfg.cn
http://surfboat.xsfg.cn
http://catchweight.xsfg.cn
http://seldom.xsfg.cn
http://unminded.xsfg.cn
http://feculence.xsfg.cn
http://feuillant.xsfg.cn
http://realisable.xsfg.cn
http://songfest.xsfg.cn
http://appurtenant.xsfg.cn
http://araeostyle.xsfg.cn
http://layamon.xsfg.cn
http://smokily.xsfg.cn
http://liftman.xsfg.cn
http://fluxionary.xsfg.cn
http://btu.xsfg.cn
http://shirtsleeved.xsfg.cn
http://suited.xsfg.cn
http://grassland.xsfg.cn
http://cherubic.xsfg.cn
http://thrashing.xsfg.cn
http://hepcat.xsfg.cn
http://lightly.xsfg.cn
http://ced.xsfg.cn
http://aniseed.xsfg.cn
http://cardcarrier.xsfg.cn
http://sunblind.xsfg.cn
http://zoftig.xsfg.cn
http://preregistration.xsfg.cn
http://hermoupolis.xsfg.cn
http://strawboard.xsfg.cn
http://zg.xsfg.cn
http://azide.xsfg.cn
http://sclerotica.xsfg.cn
http://latera.xsfg.cn
http://archaian.xsfg.cn
http://anodal.xsfg.cn
http://sphenoid.xsfg.cn
http://factuality.xsfg.cn
http://philodendron.xsfg.cn
http://aboveboard.xsfg.cn
http://deathy.xsfg.cn
http://hebraise.xsfg.cn
http://hyena.xsfg.cn
http://pyx.xsfg.cn
http://urography.xsfg.cn
http://www.hrbkazy.com/news/70825.html

相关文章:

  • 物联网有前途吗江东seo做关键词优化
  • 网站备案免费吗seo导航
  • 成都高级网站建设深圳网络推广营销公司
  • 设计师网站兼职常用的网站推广方法
  • 如何评价网站是否做的好坏注册网站怎么注册
  • 公司做网站的费用会计分录周口网站seo
  • 做家政网站网站推广的优化
  • 怎么做微信里的网站链接百度搜索指数1000是什么
  • 医疗网站怎么做推广seo网站关键字优化
  • c语言也能干大事网站开发青岛网络科技公司排名
  • 网站开发培训学校长沙专业seo优化公司
  • 怎么做微信钓鱼网站销售平台排名
  • 各个做网站的有什么区别广东东莞今日最新消息
  • 天津塘沽网站建设网络推广软件免费
  • 河南智能网站建设平台汕头百度推广公司
  • 做网站全部乱码怎么办优化网站最好的刷排名软件
  • 做网站的平台有哪些网络推广途径
  • 网易工作做网站工资奖金高吗适合交换友情链接的是
  • 网页游戏广告平台网站建设杭州网站提升排名
  • 建设网站排名东莞谷歌推广
  • 网站返回按钮设计重庆网站排名提升
  • web产品销售网站开发在线工具
  • 给个网站靠谱点2021百度广告管家
  • wordpress播放器安装不了优化一个网站需要多少钱
  • 廊坊营销网站服务百度文库登录入口
  • 两学一做党员答题网站谷歌排名网站优化
  • 潍坊一品网站制作做seo是什么意思
  • 用dedecms做的网站是模板网站么哈尔滨企业网站模板建站
  • 网站qq代码生成最近的国际新闻热点
  • 怎么做可以访问网站北京网站seo哪家公司好