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 5992735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:34:31+00:00 2026-05-22T23:34:31+00:00

I am using vector in my code std::vector<CEventLogInfo > class CEventLogInfo { // date

  • 0

I am using vector in my code

    std::vector<CEventLogInfo >

    class CEventLogInfo 
    { 
      // date and time
  unsigned short    m_sMonth;
  unsigned short    m_sDay;
  unsigned int  m_nYear;
  unsigned short    m_sHour;
  unsigned short    m_sMin;
  unsigned short    m_sSec;

  unsigned long m_nGatewayMacID;
  unsigned char m_byCommandType;
  unsigned char m_byStatus;
  unsigned char m_byEventName;
  unsigned char m_byDirection;
  unsigned short    m_nPacketLen;
  char*         m_pPacket;
     // ..some method 
 }
 CEventLogInfo::CEventLogInfo(const CEventLogInfo& refMessage)
 {      
m_sMonth        = refMessage.m_sMonth;
m_sDay          = refMessage.m_sDay;
m_nYear         = refMessage.m_nYear;
m_sHour         = refMessage.m_sHour;
m_sMin          = refMessage.m_sMin;
m_sSec          = refMessage.m_sSec;

m_nGatewayMacID = refMessage.m_nGatewayMacID;
m_byCommandType = refMessage.m_byCommandType;
m_byStatus      = refMessage.m_byStatus;
m_byDirection   = refMessage.m_byDirection;
m_byEventName   = refMessage.m_byEventName;
m_nPacketLen    = refMessage.m_nPacketLen;  
if ( m_nPacketLen!=0)
{
    m_pPacket       = new char[m_nPacketLen];
    memcpy(m_pPacket,refMessage.m_pPacket,m_nPacketLen);

}
else
    m_pPacket = NULL;

  }    


 void CEventLoggerBody::SetEventInfoList(EventInfoList& ListEventLog)
 {
EventInfoList::iterator itrEventLogInfo;
for ( itrEventLogInfo = ListEventLog.begin(); itrEventLogInfo != ListEventLog.end();itrEventLogInfo++)
{
    CEventLogInfo* pEventLogInfo = new CEventLogInfo(*itrEventLogInfo);


    m_ListEventLog.push_back(*pEventLogInfo);
}
 }
  1. here m_nPacketLen is variable but won’t go beyond 22 bytes.
  2. this vector is working fine for 2000 record(44*2000)88000 bytes but
    when it goes beyond this it is crashing.I tested it for 5000 records it is crashing in the copy constructor when SetEventInfoList is called.

So the question is

  1. what is the maximum capacity of a vector that it can hold information in it.
  2. If vector doesn’t support this much bytes then what STL container I should use for this.

Note:third party library is not allowed in my project,please suggest on pure c++ solution for this.

  • 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-05-22T23:34:32+00:00Added an answer on May 22, 2026 at 11:34 pm

    Your problem isn’t the size of the vector (while there are practical limits, you’re nowhere near them). It is most likely due to some bug in your code that gets exposed when you create more objects.

    I would recommend examining the stack trace at the point of the crash, and perhaps adding it to your question. Another good strategy is to reduce your code to the absolute minimum that’s needed to reproduce the problem and — if that doesn’t help you figure out the problem — post the resulting code here.

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

Sidebar

Related Questions

Consider the following code: #include <iostream> #include <memory> #include <vector> using namespace std; struct
For the following code: #include<iostream> #include<vector> #include<string> using namespace std; struct Test { string
I have this example code that doesn't compile: #include <iostream> #include <vector> using std::endl;
I'm trying to delete everything from a std::vector by using the following code vector.erase(
Take the following code: std::vector<std::vector<int>> v(10, 10); This code doesn't compile with libstdc++. It
Usually like this: #include <boost/assign/std/vector.hpp> vector<int> v; v += 1,2,3,4,5; Except for a: #include
In the following code: using namespace std; //ostream& operator<< (ostream& out,const string & str)
I'm having a std::vector with elements of some class ClassA . Additionally I want
I have the following code (compiler: MSVC++ 10): std::vector<float> data; data.push_back(1.0f); data.push_back(1.0f); data.push_back(2.0f); //
I have written some C++ code that generates a std::vector. I also have a

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.