如果您对AsyncIO.ForceDotNet.Force和导致WindowsXP上的内存泄漏感兴趣,那么这篇文章一定是您不可错过的。我们将详细讲解AsyncIO.ForceDotNet.Force的
如果您对AsyncIO.ForceDotNet.Force和导致Windows XP上的内存泄漏感兴趣,那么这篇文章一定是您不可错过的。我们将详细讲解AsyncIO.ForceDotNet.Force的各种细节,并对导致Windows XP上的内存泄漏进行深入的分析,此外还有关于.net – 如何调试Windows应用商店应用中的内存泄漏?、AppEngine SDK for Windows和Windows上的Ubuntu上的Bash、asp.net – 使用X-Forwarded-For Windows Filter for Windows Servers的问题、c – 如何在Windows上检测QtCreator中的内存泄漏?的实用技巧。
本文目录一览:- AsyncIO.ForceDotNet.Force()导致Windows XP上的内存泄漏(asynctask内存泄漏)
- .net – 如何调试Windows应用商店应用中的内存泄漏?
- AppEngine SDK for Windows和Windows上的Ubuntu上的Bash
- asp.net – 使用X-Forwarded-For Windows Filter for Windows Servers的问题
- c – 如何在Windows上检测QtCreator中的内存泄漏?
AsyncIO.ForceDotNet.Force()导致Windows XP上的内存泄漏(asynctask内存泄漏)
环境
生产中的操作系统:Windows XP SP3
IDE:Microsoft Visual Studio 2013旗舰版
目标框架:.NET框架3.5
NetMQ:3.3.1
AsyncIO:0.1.18
语言:C#
我们需要在Windows XP SP3上使用简单的REQ REP套接字来运行NetMQ应用程序。 我们从问题#412得知,在Windows XP上运行时,我们需要调用AsyncIO.ForceDotNet.Force(); 在使用NetMQ之前。
我们开始运行我们的应用程序一段时间(〜3分钟)后发现,因为我们每秒发送大量消息(每5毫秒1条消息或每秒12000条消息),我们看到内存泄漏的速度是〜 3MB /秒 我们的生产机器只有1 GB的RAM,并很快导致我们的应用程序崩溃。
下面的代码很好地重现了泄漏。 要查看泄漏情况,可以在任何Windows操作系统上运行(7,8或10); Windows XP SP3不是必需的(但没有AsyncIO.ForceDotNet.Force(),NetMQ不能在Windows XP SP3上运行)。
C# – 与if语句使用正则expression式
托pipeC ++方法命名
告诉Process.Start等待,直到前一个实例完成
在Linux上运行ASP.Net与标准的以微软为中心的解决scheme相比如何?
通缉:不受AbandonedMutexException影响的跨进程同步
客户端代码(阻止我们在生产环境中部署应用程序的问题代码)
class Client { static void Main(string[] args) { AsyncIO.ForceDotNet.Force(); while (true) { using (RequestSocket request = new RequestSocket()) { request.Connect("tcp://127.0.0.1:5555"); request.SendFrame("Hello"); byte[] recData; bool result = request.TryReceiveFrameBytes(TimeSpan.FromSeconds(1),out recData); if (result) Console.WriteLine(string.Format("Reply From Server:{0}",System.Text.Encoding.Default.GetString(recData))); System.Threading.Thread.Sleep(5); } } } }
相应的服务器代码(也泄漏)
class Server { static void Main(string[] args) { AsyncIO.ForceDotNet.Force(); using (ResponseSocket response = new ResponseSocket()) { response.Bind("tcp://127.0.0.1:5555"); while (true) { byte[] recData = response.ReceiveFrameBytes(); Console.WriteLine(string.Format("Reply From Server:{0}",System.Text.Encoding.Default.GetString(recData))); response.SendFrame("World"); System.Threading.Thread.Sleep(1); } } } }
客户端应用程序的内存configuration
单声道,asp.net c#和MVC如何和教程
是否可以使用.Net框架以编程方式logging对Windows共享(SMB共享)的访问?
什么是validation.NET Windows窗体的正确方法?
简单的问题关于registryCreateSubKey
我怎样才能得到一个服务来请求重启?
只是推后提交到AsyncIO,检查出来,如果它解决了你的问题,我会发布一个新版本的nuget。
https://github.com/somdoron/AsyncIO/commit/b7100a54ec55d3b3fdb9334d1f46a2ec5a070c0a
.net – 如何调试Windows应用商店应用中的内存泄漏?
现在可能会有一些新工具 – 也许是更新后的Visual Studio中的一些东西,我很想找到这些,但我之前尝试过WinDbg取得了一些成功.以下是关于如何做到这一点的旧笔记:
1. Create dump file from process manager 2. Run WinDbg (X64) 3. File/Open Crash Dump… (Crtl+D) 4. Run following: lm .load C:\windows\Microsoft.NET\Framework64\v4.0.30319\sos.dll .sympath SRV*c:\localsymbols*http://msdl.microsoft.com/download/symbols .symfix .reload !dumpheap -stat
请注意,如果您的进程是x86,特别是如果您在x64版本的Windows上运行 – 您将需要使用x86版本的调试器(WinDbg同时提供两个版本)来保存转储. SOS是WinDbg的托管内存调试扩展,不支持调试x86位进程的x64位转储.然后,您还需要分别更新sos路径,因此它看起来像这样:
.load C:\windows\Microsoft.NET\Framework\v4.0.30319\sos.dll
可能并非所有这些命令都是必要的,但这对我有用.
现在,您可以找到似乎存在于太多实例中的对象类型
!DumpHeap -type TypeName
其中type name只是类型的名称 – 不需要完全限定的命名空间.
现在,您可以检查将此对象保留在内存中的内容:
!GCRoot Object_Address
实时调试对我来说不起作用,因为当您附加调试器时应用程序似乎被暂停.我想我在某个地方看到了一个让应用程序保留在内存中的选项,但是我忘了在哪里,但是对于内存分析 – 查看静态转储文件可能就足够了.
您可以从here下载WinDbg作为Windows SDK的一部分,也可以单独下载“Windows调试工具”.
要创建转储文件 – 转到任务管理器,右键单击进程并选择“创建转储文件”.
更多链接:
http://blogs.microsoft.co.il/blogs/sasha/archive/2012/10/15/diagnosing-memory-leaks-in-managed-windows-store-apps.aspx
http://blogs.msdn.com/b/delay/archive/2009/03/11/where-s-your-leak-at-using-windbg-sos-and-gcroot-to-diagnose-a-net-memory-leak.aspx
http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/f3a3faa3-f1b3-4348-944c-43f11c339423
http://msdn.microsoft.com/en-us/library/bb190764.aspx
http://blogs.msdn.com/b/dougste/archive/2009/02/18/failed-to-load-data-access-dll-0x80004005-or-what-is-mscordacwks-dll.aspx
*编辑
根据.NET Memory Allocation Profiling with Visual Studio 2012由Stephen Toub-PerfView工具支持分析.NET Windows应用商店应用程序中的泄漏.查看Vance Morrison here的文章和视频演练.
*编辑2
Visual Studio 2013 Preview添加了一个新选项,用于分析转储文件中的托管内存堆.要做到这一点 – 只需在Visual Studio调试器中暂停您的应用程序,通过Debug / Save Dump As保存当前转储,然后恢复执行并使用您的应用程序直到您的疑似泄漏发生并再次进行转储.然后转到文件/打开/文件并打开第二个转储文件.在“操作”面板的“转储摘要”右侧,您将看到“调试管理内存”操作.选择该选项,然后在“选择基准”中选择您的第一个转储文件.您将看到托管堆上的对象列表,按类型分组,具有计数差异.请注意,您通常会先查看具有低,非零计数差异的对象,以跟踪单个泄漏源.您可以通过在“参考图形”视图中展开树来深入查看对象列表并查看将它们保留在内存中的内容.
AppEngine SDK for Windows和Windows上的Ubuntu上的Bash
我正在尝试在Windows上的Ubuntu的Bash上使用AppEngine SDK进行Go,但是我有一个错误。 这是我的代码。
的app.yaml
runtime: go api_version: go1 handlers: - url: /.* script: _go_app
main.go
package main import ( "net/http" "github.com/labstack/echo" "github.com/labstack/echo/engine/standard" ) func init() { e := echo.New() e.GET("/",func(c echo.Context) error { return c.String(http.StatusOK,"Hello,World!") }) s := standard.New("") s.SetHandler(e) http.Handle("/",s) }
这里是错误和命令。
如何正确地等待事件/过程完成不是父母?
如何打包一个Go程序,使其自给自足?
去HTTP服务器testingab vs wrk结果有很大的差别
以编程方式检测Windows 7上是否启用硬件虚拟化
如何在Linux上编译跨平台的Go语言项目?
surface@DESKTOP-U7N4QNQ:~/projects$ goapp serve INFO 2016-08-09 14:24:35,574 devappserver2.py:769] Skipping SDK update check. INFO 2016-08-09 14:24:35,665 api_server.py:205] Starting API server at: http://localhost:38070 INFO 2016-08-09 14:24:35,670 api_server.py:648] Applying all pending transactions and saving the datastore INFO 2016-08-09 14:24:35,671 api_server.py:651] Saving search indexes Traceback (most recent call last): File "/home/surface/dev/go_appengine/dev_appserver.py",line 89,in <module> _run_file(__file__,globals()) File "/home/surface/dev/go_appengine/dev_appserver.py",line 85,in _run_file execfile(_PATHS.script_file(script_name),globals_) File "/home/surface/dev/go_appengine/google/appengine/tools/devappserver2/devappserver2.py",line 1040,in <module> main() File "/home/surface/dev/go_appengine/google/appengine/tools/devappserver2/devappserver2.py",line 1033,in main dev_server.start(options) File "/home/surface/dev/go_appengine/google/appengine/tools/devappserver2/devappserver2.py",line 824,in start self._dispatcher.start(options.api_host,apis.port,request_data) File "/home/surface/dev/go_appengine/google/appengine/tools/devappserver2/dispatcher.py",line 194,in start _module.start() File "/home/surface/dev/go_appengine/google/appengine/tools/devappserver2/module.py",line 1180,in start self._watcher.start() File "/home/surface/dev/go_appengine/google/appengine/tools/devappserver2/inotify_file_watcher.py",line 220,in start self._add_watch_for_path(directory) File "/home/surface/dev/go_appengine/google/appengine/tools/devappserver2/inotify_file_watcher.py",line 205,in _add_watch_for_path raise error OSError: [Errno 22] EINVAL: '/home/surface/projects' error while running dev_appserver.py: exit status 1 surface@DESKTOP-U7N4QNQ:~/projects$
我没有任何想法来解决这个问题。 我认为这是一个SDK的问题。
在GO中找不到软件包“gopkg.in/validator.v2”错误
libgit2高山linux泊坞错误
我需要使用Nginx还是Apache来使用Lets Encrypt?
只接受来自Go的Localhost的HTTP连接?
如何在Golang中使用COM(组件对象模型)
我自己得到了答案。
这个问题发生在Windows上的Ubuntu的Bash上。
它不支持File Watcher。 (已经有人提出了一个问题https://github.com/Microsoft/BashOnWindows/issues/216 )
因此,我使用dev_appserver.py和--use_mtime_file_watcher=true选项。
这是我的完整命令,完美的作品。
$ dev_appserver.py --use_mtime_file_watcher=true /home/surface/projects/
谢谢。
asp.net – 使用X-Forwarded-For Windows Filter for Windows Servers的问题
我已经下载了二进制文件(x86版本),然后从 http://devcentral.f5.com/weblogs/Joe/archive/2009/08/19/x_forwarded_for_log_filter_for_windows_servers.aspx开始安装手册,
但是当我尝试在我的网站上打开一个网页时,我收到一个错误:
HTTP Error 500.0 – Internal Server Error
Calling GetProcAddress on ISAPI filter “C:\ISAPI Filters\F5XFFHttpModule\F5XFFHttpModule.dll” Failed
Module IIS Web Core
Notification UnkNown
Handler StaticFile
Error Code 0x8007007f
系统信息:
操作系统 – Windows Server 2008 Datacenter,32位
IIS – 7.0
.NET Framework版本 – 4.0
ISAPI Extensions& ISAPI过滤器安装好了.
过滤器也添加到ISAPI和CGI限制以及用于Web应用程序的ISAPI过滤器.
IIS用户(UISR)已读取并执行F5XFFHttpModule.dll的访问权限.
Web应用程序应用程序池在集成模式下的.NET Framework 4上运行,进程模型标识 – NetworkService(将Process Model更改为ApplicationPool没有帮助).
调试版本不会创建任何日志文件:(
我在windows事件日志中看到的内容:
The HTTP Filter DLL C:\ISAPI Filters\F5XFFHttpModule\F5XFFHttpModule.dll Failed to load. The data ithe error.
Could not load all ISAPI filters for site ‘%sitename%’. Therefore site startup aborted.
但是,过滤器在Windows7 x64 IIS7.5中运行良好.通过在Web应用程序池设置中将“启用32位应用程序”设置为true,可以修复此处描述的错误.
请帮助我解决这个麻烦.
对不起我的英语不好 :)
解决方法
我使用下载的HTTP模块作为ISAPI过滤器,即无需在IIS中安装 – 这是我的错误现在我从HTTP模块distrib(http://devcentral.f5.com/weblogs/Joe/archive/2009/12/23/x-forwarded-for-http-module-for-iis7-source-included.aspx)运行install.ps1脚本,一切正常!
感谢Joe Pruitt的帮助!
c – 如何在Windows上检测QtCreator中的内存泄漏?
解决方法
1)首先,它不能直接在Qt Creator中完成,因此您需要创建一个Visual C项目来进行内存泄漏检测.幸运的是,qmake使这很容易.打开Qt SDK命令行工具并运行:
qmake -spec win32-msvc2008 -tp vc
这将将您的项目转换为.vcproj.
2)打开此项目并添加内存泄漏检测所需的代码:
到你的main.cpp文件:
// Necessary includes and defines for memory leak detection: #ifdef _MSC_VER #define _CRTDBG_MAP_ALLOC #include <crtdbg.h> #endif // _MSC_VER #if defined(_MSC_VER) // Code to display the memory leak report // We use a custom report hook to filter out Qt's own memory leaks // Credit to Andreas Schmidts - http://www.schmidt-web-berlin.de/winfig/blog/?p=154 _CRT_REPORT_HOOK prevHook; int customreportHook(int /* reportType */,char* message,int* /* returnValue */) { // This function is called several times for each memory leak. // Each time a part of the error message is supplied. // This holds number of subsequent detail messages after // a leak was reported const int numFollowupDebugMsgParts = 2; static bool ignoreMessage = false; static int debugMsgPartsCount = 0; // check if the memory leak reporting starts if ((strncmp(message,"Detected memory leaks!\n",10) == 0) || ignoreMessage) { // check if the memory leak reporting ends if (strncmp(message,"Object dump complete.\n",10) == 0) { _CrtSetReportHook(prevHook); ignoreMessage = false; } else ignoreMessage = true; // something from our own code? if(strstr(message,".cpp") == NULL) { if(debugMsgPartsCount++ < numFollowupDebugMsgParts) // give it back to _CrtDbgReport() to be printed to the console return FALSE; else return TRUE; // ignore it } else { debugMsgPartsCount = 0; // give it back to _CrtDbgReport() to be printed to the console return FALSE; } } else // give it back to _CrtDbgReport() to be printed to the console return FALSE; } #endif int main(int argc,char *argv[]) { #if defined(_MSC_VER) _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); prevHook = _CrtSetReportHook(customreportHook); // _CrtSetBreakAlloc(157); // Use this line to break at the nth memory allocation #endif QApplication* app = new QApplication(argc,argv); int appError = app->exec(); delete app; #if defined(_MSC_VER) // Once the app has finished running and has been deleted,// we run this command to view the memory leaks: _CrtDumpMemoryLeaks(); #endif return appError; }
3)为此,您的项目现在应该能够检测内存泄漏.注意_MSC_VER定义,以便只有当您从Visual C(而不是来自Qt Creator)运行此代码时才执行此代码.这意味着您仍然可以使用Qt Creator进行开发,只要您需要检查内存泄漏,就重新运行步骤1.
4)要打破特定的内存分配,请使用_CrtSetBreakAlloc()更多信息Microsoft网站上的内存泄漏检测:http://msdn.microsoft.com/en-us/library/e5ewb1h3%28v=vs.80%29.aspx
今天的关于AsyncIO.ForceDotNet.Force和导致Windows XP上的内存泄漏的分享已经结束,谢谢您的关注,如果想了解更多关于.net – 如何调试Windows应用商店应用中的内存泄漏?、AppEngine SDK for Windows和Windows上的Ubuntu上的Bash、asp.net – 使用X-Forwarded-For Windows Filter for Windows Servers的问题、c – 如何在Windows上检测QtCreator中的内存泄漏?的相关知识,请在本站进行查询。
本文标签: