基本上我有一个程序,当它开始加载文件列表(as FileInfo)时,对于列表中的每个文件,它加载一个XML文档(如XDocument).
然后程序将数据从其中读取到容器类(存储为IEnumerables),此时XDocument超出范围.
然后程序将数据从容器类导出到数据库.导出后容器类超出范围,然而,垃圾收集器没有清理容器类,因为它的存储IEnumerable,似乎导致XDocument留在内存中(不确定这是否是原因,但任务经理正在显示XDocument未被释放的记忆.
当程序循环遍历多个文件时,程序最终会抛出一个内存不足的异常.为了减轻这种情况,我最终使用了
System.GC.Collect();
Run Code Online (Sandbox Code Playgroud)
在容器超出范围后强制垃圾收集器运行.这是有效的,但我的问题是:
XDocument内存?谢谢.
编辑:代码示例:
集装箱类:
public IEnumerable<CustomClassOne> CustomClassOne { get; set; }
public IEnumerable<CustomClassTwo> CustomClassTwo { get; set; }
public IEnumerable<CustomClassThree> CustomClassThree { get; set; }
...
public IEnumerable<CustomClassNine> CustomClassNine { get; set; }
Run Code Online (Sandbox Code Playgroud)自定义类:
public long VariableOne { get; set; }
public int VariableTwo { get; set; }
public DateTime VariableThree { get; set; } …Run Code Online (Sandbox Code Playgroud)获取通用列表包含的项类型的最佳方法是什么?抓取集合中的第一个项目并调用.GetType()很容易,但我不能总是确定集合中会有一个项目.
希望有道理.
谢谢,
桑尼
我想在BootStrap类中运行特定的登录,具体取决于当前使用的开发或测试模式.
我怎样才能做到这一点?
我正在使用Windows 7 x64,我正在尝试安装Apache Ant.我总是收到以下错误消息:
C:\ Users\xxx> ant无法找到tools.jar.预计在C:\ Program Files\Java\jre6\li b\tools.jar中找到它.Buildfile:build.xml不存在!构建失败
在各种论坛中,他们说环境变量设置不正确.我将它们设置为我的系统:
ANT_HOME:C:\ Ant
CLASSPATH:C:\ Program Files\Java\jdk1.6.0_21\bin
JAVA_HOME:C:\ Program Files\Java\jdk1.6.0_21\bin
路径:( ......很多东西......); C:\ Program Files\Java\jdk1.6.0_21\bin; C:\ ant\bin;%JAVA_HOME%\ bin;
但我仍然得到错误.你知道怎么强迫ant使用正确的目录吗?Java(JRE和JDK)出现在Program Files和Program Files(x86)中.似乎试图使用64x JRE.
我正在使用wordpress的这个插件,我被困在一个不会被重置的查询上.在以下功能中:
function WPSM_artists_autocomplete(){
$response = array();
query_posts('post_type=artist&posts_per_page=-1');
if (have_posts()) : while (have_posts()) : the_post();
$image_id = get_post_thumbnail_id();
$image_url = wp_get_attachment_image_src($image_id,'artist-icon');
$image_url = $image_url[0];
$response[] = array( get_the_ID() , get_the_title() , null, '<img src="'.$image_url.'" />'. get_the_title());
endwhile; endif;
wp_reset_query();
// Write JSON file
$output = json_encode($response);
$data = WPSM_CACHE_DIR."/data.json";
$fh = fopen($data, 'w') or die("can't open file");
fwrite($fh, $output);
fclose($fh);
// Return JSON url
echo WPSM_CACHE_URL."/data.json";
}
Run Code Online (Sandbox Code Playgroud)
我使用query_posts来填充元数据箱.但是wp_reset_query(); 似乎没有正常工作.这会影响所有其他元框和帖子相关选项.全局$ post变量设置为此查询的最新值,而不是帖子编辑页面的默认值.
我很想听听如何解决这个插件.可以用一切来让我朝着正确的方向前进.提前致谢!
干杯,
罗尼
在文档头中的外部JavaScript文件之后包含以下外部CSS文件.要确保并行下载CSS文件,请始终在外部JavaScript之前包含外部CSS.在外部CSS文件和另一个资源之间的头部找到了1个内联脚本块.要允许并行下载,请在外部CSS文件之前或在下一个资源之后移动内联脚本.
我的HTML是:
<head>
<link rel="Stylesheet" href="gStyle.css" />
<script type="text/javascript" src="gMain.js"></script>
<script type="text/javascript" language="javascript">
// Your chart object(s)
var myChart;
// Function to hold all chart creation
function initCharts() {
myChart = new ganttChart("chart1");
myChart.gAddBar("Dynamic!", "22/3/2010", "3/4/2010");
myChart.gLoadData("Going to the shop*4/3/2010*19/3/2010*Watching TV*9/3/2010*23/3/2010*Watching TV*1/3/2010*23/3/2010*Watching TV*18/3/2010*28/3/2010*END INPUT*1/3/2010*9/3/2010");
myChart.gDraw();
myChart.gChangeBarColour(1, "#dd2200");
myChart.gChangeBarColour(2, "#9900ee");
myChart.gChangeBarColour(3, "#00dd00");
myChart.gChangeBarColour(4, "#ffbb00");
myChart.gChangeBarColour(5, "#00aa99");
}
</script>
</head>
<body onload="initCharts()">
<div id="chart1" class="gContainer">
</div>
<div id="db"></div>
</body>
Run Code Online (Sandbox Code Playgroud)
它是否在身体内联脚本之间混淆了?
当尝试切换/签出(在TortoiseGit中)到另一个分支时,我收到以下错误:
error: unable to unlink old 'foo/bar.cfc' (Bad file descriptor)
Run Code Online (Sandbox Code Playgroud)
这是什么意思?
我想提出,你打开它的应用程序,它会使用你的lang /长点查找最近的(例如:店)什么API,或将我需要做的这算什么?
/*这个应用程序是为iPhone*\
我试图在Oracle中创建一个表并获取错误: ORA-00904: : invalid identifier
这是我的命令.我真的看不出任何问题.请帮我识别错误.谢谢.
CREATE TABLE Sale (
CustomerId INT NOT NULL ,
BarCode INT NOT NULL ,
SalesId INT NOT NULL ,
Date DATE NULL ,
CheckOut TINYINT(1) NULL ,
PRIMARY KEY (CustomerId, BarCode, SalesId) ,
CONSTRAINT fk_Customer_has_Product_Customer
FOREIGN KEY (CustomerId )
REFERENCES Customer (CustomerId )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT fk_Customer_has_Product_Product1
FOREIGN KEY (BarCode )
REFERENCES Product (BarCode )
ON DELETE NO ACTION
ON UPDATE NO ACTION);
Run Code Online (Sandbox Code Playgroud) 在PHP中,我可以这样做:$ var =(int)$ _POST ['var'];
有没有办法将ColdFusion变量显式设置为整数或字符串?
c# ×2
ant ×1
apache ×1
audit ×1
coldfusion ×1
collections ×1
generics ×1
git ×1
grails ×1
groovy ×1
html ×1
iphone ×1
java ×1
javascript ×1
linq ×1
linq-to-xml ×1
meta ×1
ora-00904 ×1
oracle ×1
oracle10g ×1
sql ×1
tortoisegit ×1
wordpress ×1