473,320 Members | 1,976 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Stack Overflow

I m declaring an array : int a[1000000] in C. The program on
execution becomes non responsive possibly because of stack overflow as a[100000] is working fine. I don't want to declare my array dynamically as I have to use all length in
a[1000000] at a tym. Somehow I hv managed to get successful execution on ideone.com but its still not working on my system and I m still getting TLE on an online judge. Plz suggest a faster method (if possible) for it.
Mar 7 '12 #1
1 1754
Banfa
9,065 Expert Mod 8TB
You really shouldn't every put more than a few kbytes onto the stand and for some platforms that should be more than a few bytes.

Allocating your array dynamically doesn't stop you using all of it at the same time and really is the best answer to this problem. The alternative is to make the array static but then there is a single copy that is permanently in existence so if your program is multithreaded you will need to protect against multiple concurrent access attempts.
Mar 7 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: ip4ram | last post by:
I am quite puzzled by the stack overflow which I am encountering.Here is the pseudocode //define stack structure //function operating on stack void my_stack_function( function parameters) {...
7
by: Aguilar, James | last post by:
Hello all, To begin, yes, this -is- a homework assignment. However, it is for my Algorithms class, and my instructor has given us explicit permission to use "expert" groups like newsgroups, so...
19
by: Jim | last post by:
I have spent the past few weeks designing a database for my company. The problem is I have started running into what I believe are stack overflow problems. There are two tab controls on the form...
4
by: Victor | last post by:
Hello, I've got a situation in which the number of (valid) recursive calls I make will cause stack overflow. I can use getrlimit (and setrlimit) to test (and set) my current stack size. ...
2
by: David W. Walker | last post by:
I am attempting to port a C code that runs OK on a number of Linux and Unix machines to Windows XP using Visual Studio C++. I have set the program up as a console application, but when I try to run...
5
by: jbix | last post by:
We have a stack overflow happening. We are NOT doing any recusion. We do have an object being created in Global that is being handed the Context (which I assume is specific to the request thread). ...
7
by: amit.atray | last post by:
Environement : Sun OS + gnu tools + sun studio (dbx etc) having some Old C-Code (ansi + KR Style) and code inspection shows some big size variable (auto) allocated (on stack) say for ex. char...
12
by: Geoff Cox | last post by:
Hello, Some one is getting the "stack overflow" error message when using a Javascript program which I wrote when using Internet Explorer but not when using Mozilla. Any ideas as to how I...
2
by: =?Utf-8?B?VG9tIEFsbGVu?= | last post by:
Hi, TIA for any help. (Thanks, Mattias Sjögren for your help yesterday! ) I am developing a C# wrapper for a 3rd party API. It processes buffers from a video stream (file) and is structured...
5
by: moondaddy | last post by:
I'm trying to serialize some xaml elements using the XamlWriter and I'm getting a stack overflow error because the elements have some public properties which get called about a million ( a lot)...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.