stack-overflow

QuickSort with Many Elements causes StackOverflowError

不打扰是莪最后的温柔 提交于 2019-12-11 16:21:25
问题 Good day! I am getting a StackOverflowError when running my quickSort algorithm. This error occurs when elements in the array > 50 000. My code is below : public void recQuickSort(int left, int right) { if(right-left <= 0) return; else { long pivot = a[right]; int partition = partitionIt(left, right, pivot); recQuickSort(left, partition-1); recQuickSort(partition+1, right); } } public int partitionIt(int left, int right, long pivot) { int leftPtr = left - 1; int rightPtr = right; while (true)

Recursion into stack-form. Preserving a search path towards ends of recursion

妖精的绣舞 提交于 2019-12-11 14:45:25
问题 A short form of question is: How do I convert a recursive search into a stack search? The trick is to be able to grab a branch that leads towards each of the recursion's endings. This Article's suggestion won't work as the path to the ending cannot be traced. (Ultimately if we could save each step into array via the reference to trace later on) I am using c#, and building a web of nodes. Each node contains an information about its neighbors. Also, each node contains 2 arrays. The 1st one is

Automapper 6.0.2.0, Mapper.Map() throws StackOverflow when mapping Child Entities

谁说我不能喝 提交于 2019-12-11 14:08:34
问题 Getting straight to the point, I've got the following Models: public abstract class ControlData { public DateTime CreatedDate { get; set; } public int CreatedById { get; set; } [ForeignKey("CreatedById")] public Collaborator CreatedBy { get; set; } public DateTime? UpdatedDate { get; set; } public int? UpdatedById { get; set; } [ForeignKey("UpdatedById")] public Collaborator UpdatedBy { get; set; } } [Table("My_Position_Table")] public class Position : ControlData { [Key] [Column("PositionId"

Stack overflow from local variables?

坚强是说给别人听的谎言 提交于 2019-12-11 13:50:10
问题 Let me start by saying my question is not about stack overflows but on way to make it happen, without compile-time errors\warnings. I know (first hand) you can overflow a stack with recursion: void endlessRecursion() { int x = 1; if(x) endlessRecursion(); //the 'if' is just to hush the compiler } My question is, is it possible to overflow the stack by declaring too many local variables. The obvious way is just declare a huge array like so: void myStackOverflow() { char maxedArrSize[0x3FFFFFFF

Need to prevent PHP regex segfault

瘦欲@ 提交于 2019-12-11 12:49:25
问题 Why does the following segfault, and how can I prevent it? <?php $str = ' <fieldset> <label for="go-to">Go to: </label> ' . str_repeat(' ', 10000) . '<input type="submit" value="Go" /> </fieldset> </form>'; preg_match_all("@ </?(?![bisa]\b)(?!em\b)[^>]*> # starting tag, must not be one of several inline tags (?:[^<]|</?(?:(?:[bisau]|em|strong|sup)\b)[^>]*>)* #allow text and some inline tags [\?\!\.]+ @ix", $str, $matches); ?> I believe it's causing a .... wait for it .... stack overflow. EDIT

WPF4/C# - System.StackOverflowException Crashing App

时光怂恿深爱的人放手 提交于 2019-12-11 10:36:25
问题 Below you can see my .xaml.cs code. The app opens fine. There are 4 textboxes which the user can change. When you edit one of the default values in the textboxes and then click off to not select it, the app crashes with the System.StackOverflowException error, saying I have an infinite loop or recursion on either the get{} or Calc() function, depending on which textbox is edited. I want the app to calculate the numbers according to the Calc() function every time a textbox is not being edited.

Static global variables vs global variables C

孤者浪人 提交于 2019-12-11 10:36:12
问题 I have the program below. If i declare variables a,b,c static global variables, it gives segmentation fault, but if i declare them non-static global or as local variables, it won't give segmentation fault. Why does it behave in such a way? I know that there is more data than variables can store, but why does it give seg fault when only its declared static? Are statically declared variables stored in some different part of the the stack frame where overwriting is not allowed? EDIT: I know

delete overload, recursive overflow

自闭症网瘾萝莉.ら 提交于 2019-12-11 07:48:06
问题 Hey guys i wrote a quick test. I want delete to call deleteMe which will then delete itself. The purpose of this is so i can delete obj normally which are allocated by a lib. (i dont want any crashes due to crt or w/e). With delete this i get a stackoverflow, without it msvc says i leaked 4 bytes. When i dont call test i leak 0. How do i delete w/o a recursion problem? -edit- to make this more clear. I want the LIB to call delete (thus deleteMe) instead of the program due to crt class B {

Entity Framework navigation property

我的未来我决定 提交于 2019-12-11 07:18:26
问题 I'm trying to use EF to get data from my database. I have a table Interventions that has a Client associated with it like this: public partial class Client { public Client() { this.Interventions = new List<Intervention>(); } public int client_id { get; set; } public string full_name { get; set; } public string cgroup { get; set; } public string nation { get; set; } public virtual ICollection<Intervention> Interventions { get; set; } } public partial class Intervention { public int

What does stack overflow actually mean in a .Net world?

本小妞迷上赌 提交于 2019-12-11 07:08:38
问题 What does stack overflow actually mean in a .Net garbage collected world? 回答1: A stack overflow and garbage collection are essentially orthogonal concepts: stack vs. heap. The purpose of the garbage collector is to reclaim unreachable objects which live in the heap. A stack overflow occurs when the execution stack exceeds the limit allowed by the current thread. All items on the stack are by definition reachable hence the garbage collector can do nothing to "clean up" the stack 回答2: Exactly