如何处理“Stack Overflow”? [英] How to handle "Stack Overflow"?

查看:88
本文介绍了如何处理“Stack Overflow”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我目前正在使用vc ++开发用户模式服务,而测试我看到我的服务由于"Stack Overflow"而崩溃了。错误。



我创建了一个拥有1 Gb RAM和1个内核的虚拟机,对于这台机器我已经禁用了分页,然后我正在运行"TestLimit.exe -d"这将尽可能地泄漏内存。



然后我的服务随机崩溃"Stack Overflow"。因为没有为线程堆栈分配的内存。



那么我该如何处理这种情况?



谢谢

I am currently developing a user mode service using vc++, while testing I have seen my service is getting crashed due to the "Stack Overflow" error.

I have created a VM with 1 Gb RAM and 1 core, for this machine I have disabled the paging then also with I am running "TestLimit.exe -d" which will leak the memory as much as possible.

Then my service crashes randomly with "Stack Overflow" because there is no memory to allocate for thread stack.

So how should I handle this case?

Thanks

谢谢SOU

推荐答案


大家好,

Hi All,

我目前正在使用vc ++开发用户模式服务,而测试我看到我的服务由于"Stack Overflow"而崩溃了。错误。



我创建了一个拥有1 Gb RAM和1个内核的虚拟机,对于这台机器我已经禁用了分页,然后我正在运行"TestLimit.exe -d"这将尽可能地泄漏内存。



然后我的服务随机崩溃"Stack Overflow"。因为没有为线程堆栈分配的内存。



那我该如何处理这种情况呢?

I am currently developing a user mode service using vc++, while testing I have seen my service is getting crashed due to the "Stack Overflow" error.

I have created a VM with 1 Gb RAM and 1 core, for this machine I have disabled the paging then also with I am running "TestLimit.exe -d" which will leak the memory as much as possible.

Then my service crashes randomly with "Stack Overflow" because there is no memory to allocate for thread stack.

So how should I handle this case?

我认为您需要准确说明您遇到的问题。

I think you need to clarify exactly what you are experiencing.

例如,确切地说,当收到错误(文本和代码)时"崩溃"会发生什么?

For example, exactly what errors (text and codes) are received when the "crash" happens?

有问题的线程是否实际溢出其堆栈,或者由于内存条件较低而导致创建线程的调用失败了吗?

Does the thread in question actually overflow its stack or does the call to create the thread fail due to the low memory conditions?

是您在创建线程时使用默认堆栈大小?

Are you using the default stack size when you create the thread?

您的代码如何使用堆栈? 递归函数? 分配大量数据?

How does your code use the stack?  Recursive functions?  Allocation of large amounts of data?

最后,考虑到相当极端的测试条件(1 GB VM(未知的Windows版本),没有分页文件和最大内存泄漏),似乎意图是测试在低内存条件下无法正常处理错误的代码。 它看起来像你可能找到了一些

Finally, considering the rather extreme test conditions (1 GB VM (unknown windows version), no paging file and maximum memory leaks) it seems that the intent is to test for code that fails to gracefully handle errors in low memory conditions.  It looks like you may have found some.


这篇关于如何处理“Stack Overflow”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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