| delorie.com/archives/browse.cgi | search |
| From: | David Eberhard <toothpck AT xmission DOT com> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | problem with memory allocation (I think) |
| Date: | Thu, 08 Jan 1998 00:19:22 -0700 |
| Organization: | XMission Internet (801 539 0900) |
| Lines: | 34 |
| Message-ID: | <34B47DFA.E0D6D796@xmission.com> |
| NNTP-Posting-Host: | slc129.modem.xmission.com |
| Mime-Version: | 1.0 |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
I am getting a runtime error when running my program. Here is the
part that is not running correctly:
long i;
unsigned int *buffer;
buffer = malloc(640 * 480 * 2);
for(i = 0; i < 640*480; i++)
{
buffer[i] = i;
}
and here's the error message I get:
Exiting due to signal SIGSEGV
General Protection Fault at eip=0000194a
eax=001c0000 ebx=00021fff ecx=00006ccc edx=0000006c esi=00021ffe
edi=00000005 ebp=0004efe0 esp=0004eebc
program=c:/cplus/djgpp/graphics.exe
cs: sel=1b9f base=835be000 limit=001bffff
ds: sel=1ba7 base=835be000 limit=001bffff
es: sel=1ba7 base=835be000 limit=001bffff
fs: sel=1b3f base=00017bb0 limit=0000ffff
gs: sel=1bb7 base=00000000 limit=ffffffff
ss: sel=1ba7 base=835be000 limit=001bffff
Call frame traceback
EIPs: 0x0000194a
0x00001f96
If I change the for loop so that it only loops 640*480/2 times, then
it works fine. Can anyone tell me what's going on?
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |