stack-overflow

TextWatcher afterTextChanged causes stackoverflow in android

可紊 提交于 2019-12-10 13:57:16
问题 I have a method drawItems() which everytime creates a new layout and sets it as a contentView . And I also have a control EditText which should remove other elements when it's content is changed. edit.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable s) { currentText = s.toString(); drawItems(); } public void beforeTextChanged(CharSequence s, int start, int count, int after) { } public void onTextChanged(CharSequence s, int start, int before, int count) { } });

Work-around a StackOverflowException

牧云@^-^@ 提交于 2019-12-10 13:45:50
问题 I'm using HtmlAgilityPack to parse roughly 200,000 HTML documents. I cannot predict the contents of these documents, however one such document causes my application to fail with a StackOverflowException . The document contains this HTML: <ol> <li><li><li><li><li><li>... </ol> There are roughly 10,000 <li> elements nested like that. Due to the way HtmlAgilityPack parses HTML it causes a StackOverflowException . Unfortunately a StackOverflowException is not catchable in .NET 2.0 and later. I

I get an error EStackOverflow when creating packed struct in delphi 7.0

放肆的年华 提交于 2019-12-10 13:44:59
问题 I'm getting an EStackOverflow when creating a packed struct in Borland Delphi 7.0 I want to do the following: Type T4 = packed record VT : integer; SKT : byte; end; T3 = packed record O : boolean; TT4 : array of T4; end; T2 = packed record con : boolean; TT3 : array [64..90,64..90] of T3; End; TTT = array [64..90,64..90] of T2; procedure TForm1.Button1Click(Sender: TObject); var Arr : TTT; begin Arr[64,64].con:=false; end; But when I run the program and click the button, I get an

Undeclared identifier in C function

荒凉一梦 提交于 2019-12-10 11:58:11
问题 This question was migrated from Software Engineering Stack Exchange because it can be answered on Stack Overflow. Migrated 6 years ago . When I compile the following C function / program I get errors like "missing ';' before 'type' 'remainder' : undeclared identifier" - what is wrong with this function? #include <stdio.h> void conversionTo(int number,int base) { if(number==0) return; int remainder=number%base; conversionTo((number/base),base); if(remainder<10) printf("%c",'0'+remainder); else

Stack overflow error when reading jpeg image using Cimg library

谁说胖子不能爱 提交于 2019-12-10 11:45:16
问题 I'm getting stack overflow error when I'm trying to read jpg file using Cimg library while other format bmp is working file . How can i resolve it? #include"CImg.h" #include<stdio.h> using namespace cimg_library; int main() { CImg<unsigned char> src("d:\\sidimg.jpg"); int width = src.width(); int height = src.height(); unsigned char* ptr = src.data(0,0); int count=0; while(count!= width*height) { printf("%d",*ptr); ptr++; count++; } } 回答1: Sorry for the late answer, but you have to have

VERY strange stack overflow in C++ program

给你一囗甜甜゛ 提交于 2019-12-10 11:13:54
问题 I wrote a program some time ago (Mac OS X, C++, SDL, FMOD) and it perfomed rather good. But lately I wanted to extend its functionality and added some more code to it. And now, when I run it and try to test the new functionality, the program crashes with SIGABRT. Looking into debugger, on function stack I see: _kill kill$UNIX2003 raise __abort __stack_chk_fail odtworz <-- my function that was was modified As far as I know, "__stack_chk_fail" indicates a stack overflow. But that's not the

Monitoring call stack size in Visual Studio

独自空忆成欢 提交于 2019-12-10 10:28:47
问题 Is there a way to monitor the call stack size in Visual Studio ? A call stack window is provided while running but does not show the size of the stack. I am using C++ and facing stack overflow issue. I know something might be wrong about some recursive functions I am using, but before solving these issues I would like to monitor the call stack size to see what is going on. 回答1: Using a data breakpoint can be helpful here. Wherever you happen to be in the code, it doesn't matter as long as you

Why would a C++ program allocate more memory for local variables than it would need in the worst case?

血红的双手。 提交于 2019-12-10 03:17:17
问题 Inspired by this question. Apparently in the following code: #include <Windows.h> int _tmain(int argc, _TCHAR* argv[]) { if( GetTickCount() > 1 ) { char buffer[500 * 1024]; SecureZeroMemory( buffer, sizeof( buffer ) ); } else { char buffer[700 * 1024]; SecureZeroMemory( buffer, sizeof( buffer ) ); } return 0; } compiled with default stack size (1 megabyte) with Visual C++ 10 with optimizations on (/O2) a stack overflow occurs because the program tries to allocate 1200 kilobytes on stack. The

JPA: java.lang.StackOverflowError on adding toString method in entity classes

狂风中的少年 提交于 2019-12-09 18:01:34
问题 Everything worked fine until I added toSting() in my entity classes. After which I start getting the following error in runtime: Exception in thread "main" java.lang.StackOverflowError at java.lang.AbstractStringBuilder.append(Unknown Source) at java.lang.StringBuilder.append(Unknown Source) at java.lang.StringBuilder.<init>(Unknown Source) at entity.Guide.toString(Guide.java:51) at java.lang.String.valueOf(Unknown Source) at java.lang.StringBuilder.append(Unknown Source) at entity.Student

Why does calling calling requestAnimationFrame at the beginning of a loop not cause infinite recursion?

ぐ巨炮叔叔 提交于 2019-12-09 17:33:07
问题 What is going on that allows the rest of the loop to execute, and then for requestAnimationFrame to execute next frame? I am misunderstanding how this method works, and can't see a clear explanation anywhere. I tried reading the timing specification here http://www.w3.org/TR/animation-timing/ but I couldn't make out how it worked. Edit: For example, this code is taken from the threejs documentation. var render = function () { requestAnimationFrame(render); cube.rotation.x += 0.1; cube