Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7916033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:39:32+00:00 2026-06-03T14:39:32+00:00

As far as I know, this isn’t caused by an infinite recursion. The program

  • 0

As far as I know, this isn’t caused by an infinite recursion.

The program functioned correctly with smaller arrays (it is an audio editor). Now I have increased functionality to allow for larger arrays (up to 5 minutes of audio, 26460000 pieces of 16bit data ~50mb).

Since increasing the array’s size I am receiving stack overflow errors on one particular function, where it should reverse the playback of an input file by writing the array into a new array backwards, then overwriting the original array. I’m guessing as each array could be up to 50MB this may be where the problem lies:

//initialise temporary new array to place samples in
short signed int reverse_data[max_number_samples];  

for (i=0; i<track_samples; i++)
{  //puts data from sound_data into reverse_data backwards.
  reverse_data[(max_number_samples-1)-i]=sound_data[i];    
}

for (i=0; i<track_samples; i++)    
{     //now overwrites sound_data with the data in reverse_data
  sound_data[i]=reverse_data[i];
}

I’m fairly new to C++, and programming in general, and am unsure of what the errors I get during debug are really telling me.

Any help would be appreciated, I’m sure there’s a simple enough solution (I’ve read stuff involving ‘heaps’ but I’m not confident of what a’heap’ really is).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T14:39:35+00:00Added an answer on June 3, 2026 at 2:39 pm

    As Vlad pointed out, don’t allocate 50MB on the stack.

    But, the point is moot because you don’t need to allocate any data. Try replacing your entire code fragment with a single call to std::reverse:

    std::reverse(&sound_data[0], &sound_data[track_samples]);
    

    Postscript: Don’t forget to #include <algorithm>.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As far as I know this isn't possible. I would like to draw an
I know this technically isn't supported (and as far as I can tell it's
I know this is far fetched, but I've received an IPA game from a
I know this topic was descibed few times so far, but here is mine
As far as I know there is no way to do this, but I
I have this so far but I don't know how to write over the
I know this isn't RESTful, but for now, I'm trying to set up an
I know this isn't the right place to ask about this specific vague problem,
I know this probably isn't possible, but I would like to be able to
I know this isn't the best way to do it, but I have no

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.