How to fix VB6 crash while Writing EXE 
Author Message
 How to fix VB6 crash while Writing EXE

I recently ran into a problem where the VB5 SP5 IDE crashes while
Writing the .EXE file. That's after successfully finishing the compile
on an application that works perfectly when run inside the IDE.

It's not running out of memory or disk space resources, and happens on
a variety of machines running either NT4 SP5 or Win2K SP2. Every time
VB6 crashes with a Application Error that "The memory could not be
"written"."

In searching the newsgroups I found other people had hit this problem,
but no solution was posted, but I eventually found the answer in a VB
FAQ (Section 12.1).

In the IDE, arrays are dynamic by default. When compiled, arrays are
static by default. According to the FAQ this changes where the arrays
are stored (DGROUP instead of heap). Apparently, VB6 SP5 still has
problems that have been around for a very long time in how it handles
static arrays.

To fix it, you need to put the comment:
'DYNAMIC
as the first line the .frm source.

You could also manually use dynamic arrays and ReDim, but this is a
quicker change for existing code.

That forces all arrays to be dynamic, even when compiled. It fixed the
problem for me.

Good luck.



Tue, 29 Jun 2004 23:50:49 GMT  
 How to fix VB6 crash while Writing EXE
Just wanted to clarify something. The subject says "how to fix VB6
crash...." but in your message you say you ran into the problem using VB5. I
remember writing a program ages ago with vb5 and I had basically finished it
when I tried to compile and vb crashed. I wish I had had this solution at
the time. Also another thing, so you add the comment to every form? Or every
form with dynamic arrays? And do you need to add the comment in the general
declarations sectio before all the code or do you need to open the .frm file
in Notepad and add it there somewhere?

Thanks,

Alex


Quote:
> I recently ran into a problem where the VB5 SP5 IDE crashes while
> Writing the .EXE file. That's after successfully finishing the compile
> on an application that works perfectly when run inside the IDE.

> It's not running out of memory or disk space resources, and happens on
> a variety of machines running either NT4 SP5 or Win2K SP2. Every time
> VB6 crashes with a Application Error that "The memory could not be
> "written"."

> In searching the newsgroups I found other people had hit this problem,
> but no solution was posted, but I eventually found the answer in a VB
> FAQ (Section 12.1).

> In the IDE, arrays are dynamic by default. When compiled, arrays are
> static by default. According to the FAQ this changes where the arrays
> are stored (DGROUP instead of heap). Apparently, VB6 SP5 still has
> problems that have been around for a very long time in how it handles
> static arrays.

> To fix it, you need to put the comment:
> 'DYNAMIC
> as the first line the .frm source.

> You could also manually use dynamic arrays and ReDim, but this is a
> quicker change for existing code.

> That forces all arrays to be dynamic, even when compiled. It fixed the
> problem for me.

> Good luck.



Wed, 30 Jun 2004 01:28:39 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. VB6 crashes while writing exe

2. VB5 crashes when writing EXE

3. VB5 crashes when writing EXE

4. datareport seems to crash writing of exe file

5. VB5 Crashes when writing the exe file

6. Installation of program written in VB6 crashes Windows

7. VB6.EXE keeps crashing (references CCW) - it is caught in VS.NET

8. huge forms/project crashes my vb6.exe

9. VB6.EXE crash calling Help

10. VB6 EXE crash, with IDE OK. Event sink in VM60.dll

11. vb6.exe crashes when started

12. Making exe will crash VB6 IDE

 

 
Powered by phpBB® Forum Software