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

  • Home
  • SEARCH
  • 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 8546869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:08:05+00:00 2026-06-11T13:08:05+00:00

So I wrote an implementation of an ArrayList over the summer, and I have

  • 0

So I wrote an implementation of an ArrayList over the summer, and I have a toString method within which I use an ostringstream object to tack on strings and then output them.

the method is below:

template<class T>
std::string ArrayList<T>::toString() {

    std::ostringstream streamOut;

    streamOut << "(";

    for (int i = 0; i < size; i++) {

        streamOut << array[i];

        if (i != (size - 1)) {

            streamOut << ", ";
        }
    }

    streamOut << ")\n";

    std::string returnString = streamOut.str();

    return returnString;
}

The problem is that when I run this program it sometimes crashes on the line in the above method:

    streamOut << "(";

I tried adding a flush statement at the end but that didn’t do the trick…I really have no idea what could be wrong here.

I think this issue may be related but I can’t be sure….

https://stackoverflow.com/questions/8250851/big-ostringstream-causes-application-crash

EDIT:

I forgot to mention, that I am using eclipse for development, and I have been unable to get a crash of the program to occur when I run it in eclipse. It’s only when I run the exe generated via windows or the command line that it crashes

  • 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-11T13:08:06+00:00Added an answer on June 11, 2026 at 1:08 pm

    I think it crashed because somewhere before this method incorrectly free the memory.

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

Sidebar

Related Questions

I have written a TCP server implementation using which I created an application which
I wrote a UnitOfWork implementation that does not expose a public Commit() method. Instead
I wrote my implementation of printf – myPrintf,which prints to stdout. I want to
I wrote an implementation of vector, which compiles but is not working properly according
I wrote this implementation of the Sieve of Eratosthenes in c++, but whenever the
I wrote an implementation of inversion-counting. This is an assignment being carried out in
I got one implementation of read/write locks which is below. Notice that in the
I wrote an implementation for a priority queue I needed, and now I would
I wrote an implementation of the Mandelbrot set in Java using a JComponent but
I wrote a linked list implementation for my java class earlier this year. This

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.