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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T04:06:27+00:00 2026-05-11T04:06:27+00:00

I have c++ code that attempts to dynamically allocate a 2d array of bytes

  • 0

I have c++ code that attempts to dynamically allocate a 2d array of bytes that measures approx 151MB in size. When I attempt to go back and index through the array, my program crashes in exactly the same place every time with an ‘Access violation reading location 0x0110f000’ error, but the indicies appear to be in range. That leads me to believe the memory at those indicies wasn’t allocated correctly.

1) What’s the max number of bytes you can dynamically allocate using the new operator?

2) If it is the case that I’m failing to dynamically allocate memory, would it make sense that my code is crashing when attempting to access the array at exactly the same two indicies every time? For some reason, I feel like they would be different every time the program is run, but what do i know 😉

3) If you don’t think the problem is from an unsuccessful call to new, any other ideas what could be causing this error and crash?

Thanks in advance for all your help!

*Edit

Here’s my code to allocate the 2d array…

#define HD_WIDTH 960 #define HD_HEIGHT 540 #define HD_FRAMES 100  //pHDVideo is a char** pHDVideo->VideoData = new char* [HD_FRAMES];  for(int iFrame = 0; iFrame < HD_FRAMES; iFrame++) {     //Create the new HD frame     pHDVideo->VideoData[iFrame] = new char[HD_WIDTH * HD_HEIGHT * 3];     memset(pHDVideo->VideoData[iFrame], 0, HD_WIDTH * HD_HEIGHT * 3); } 

and here’s a screenshot of the crashing code and debugger (Dead Link) it will help.

I should add that the call to memset never fails, which to me means the allocations is successful, but I could be wrong.

EDIT I found a fix everyone, thanks for all your help. Somehow, and I still need to figure out how, there was one extra horizontal line being upscaled, so I changed…

for(int iHeight = 0; iHeight < HD_HEIGHT; iHeight++) 

to

for(int iHeight = 0; iHeight < HD_HEIGHT-1; iHeight++) 

and it suddenly worked. Anyhow, thanks so much again!

  • 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. 2026-05-11T04:06:27+00:00Added an answer on May 11, 2026 at 4:06 am

    Some possibilities to look at or things to try:

    • It may be that the pHDVideo->VideoData[iFrame] or pHDVideo->VideoData is being freed somewhere. I doubt this is the case but I’d check all the places this can happen anyway. Output a debug statement each time you free on of those AND just before your crash statement.
    • Something might be overwriting the pHDVideo->VideoData[iFrame] values. Print them out when allocated and just before your crash statement to see if they’ve changed. If 0x0110f000 isn’t within the range of one of them, that’s almost certainly the case.
    • Something might be overwriting the pHDVideo value. Print it out when allocated and just before your crash statement to see if it’s changed. This depends on what else is within your pHDVideo structure.
    • Please show us the code that crashes, with a decent amount of context so we can check that out as well.

    In answer to your specific questions:

    1/ It’s implementation- or platform-specific, and it doesn’t matter in this case. If your new’s were failing you’d get an exception or null return, not a dodgy pointer.

    2/ It’s not the case: see (1).

    3/ See above for some possibilities and things to try.

    Following addition of your screenshot:

    You do realize that the error message says ‘Access violation reading …’?

    That means it’s not complaining about writing to pHDVideo->VideoData[iFrame][3*iPixel+2] but reading from this->VideoData[iFrame][3*iPixelIndex+2].

    iPixelIndex is set to 25458, so can you confirm that this->VideoData[iFrame][76376] exists? I can’t see from your screenshot how this->VideoData is allocated and populated.

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

Sidebar

Ask A Question

Stats

  • Questions 105k
  • Answers 105k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You need to get a license to flex builder pro… May 11, 2026 at 8:39 pm
  • Editorial Team
    Editorial Team added an answer You'll need to setup a callback service; I wrote a… May 11, 2026 at 8:39 pm
  • Editorial Team
    Editorial Team added an answer You'd probably have to use an iframe with a page… May 11, 2026 at 8:39 pm

Related Questions

I'm working on a large, aging code base for an MFC app. The code
I've recently started poking around in Visual Studio 2005, and I'm mucking about in
Project Darkstar was the topic of the monthly JavaSIG meeting down at the Google
We’ve found that the unit tests we’ve written for our C#/C++ code have really

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.