增加vb.net中的堆栈大小 [英] Increase stack size in vb.net

查看:164
本文介绍了增加vb.net中的堆栈大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用vb.net.My Project在32bit上运行良好。但是在64位中它给出了堆栈溢出异常。我想知道我有什么方法或技巧可以增加堆栈的大小。在vb.net中是可能的。

I am working on vb.net.My Project execute well on 32bit.But in 64 bit it gives Stack overflow Exception.I want to know that is there any method or trick by which I can increase the size of stack.Is it possible in vb.net.

推荐答案

你可能在代码中做错了。除非你确切地知道为什么需要增加堆栈大小,否则只会导致相同的错误,但只需要更长的时间就可以到达那里。



那么,什么你这样做是在破坏默认的1MB堆栈空间吗?
Chances are you're doing something wrong in your code. Unless you know precisely why you need to increase the stack size, doing so will only result in the same error, but just take longer to get there.

So, what are you doing that is trashing the default 1MB of stack space?


AFAIK,你不能改变默认的堆栈大小 - 它是1Mb,这是你的命运。话虽如此,你可以在产生一个线程时设置一个新的stacksize,这样可能有所帮助 - 我不知道你的代码是如何工作的,所以我无法评论。 MSDN线程构造函数 [ ^ ] - 请注意您需要管理员权限才能在.NET 4及更高版本中将堆栈提升到1MB以上。 />
一个1Mb的堆栈非常大:除非你正在以惊人的程度递归,或者使用大量的大值类型,你不应该靠近它。您是否查看了代码以查看其内存使用是否可以优化?
AFAIK, you cannot change the default stacksize - it is 1Mb and that's your lot. Having said that, you can set a new stacksize when you spawn a thread, so that may help - I don't know how your code works, so I can't comment. MSDN Thread constructor[^] - do note that you need admin privileges to raise the stack above 1MB in .NET 4 and above.
A 1Mb stack is pretty big: Unless you are recursing to an alarming degree, or use a heck of a lot of big valuetypes you shouldn't come anywhere near it. Have you looked at your code to see if it's memory use can be optimised?


您可以使用editbin.exe设置二进制文件的堆栈大小。
You can set the stack size of the binary using editbin.exe.


这篇关于增加vb.net中的堆栈大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆