Problems running self-building code with Unicode

From: Toby Sharp (toby_sharp)
Date: 06/09/04


Date: Wed, 9 Jun 2004 15:05:47 +0100

I have an app developed with C++ and inline assembly, compiled with MSDEV
.NET.

In the program, I generate code in memory at run-time which is then
executed. The memory where the code is built is allocated with VirtualAlloc
with PAGE_EXECUTE_READWRITE access. After building the code I call
    FlushInstructionCache(::GetCurrentProcess(), NULL, 0);

The program runs very well in all but one circumstance. It works in Debug
mode, in Release mode, in Unicode Debug mode. It works in Unicode Release
mode if run from within the debugger (F5). But if run outside the debugger
in Unicode Release mode, it crashes with:

"Runtime Error!
Program: <appname>.exe
This application has requested the Runtime to terminate in an unusual way.
Please contact the application's support team for more information."

Then:

"The instruction at 0x7c2b88b5 referenced memory at 0x0000001c. The memory
could not be read. Click on OK to terminate the program."

Then:

"Runtime Error!
Program: <appname>.exe
R6025 - pure virtual function call"

I use the same code in a test app and it works fine. The only substantial
difference that I can think of is that in the real app (where it crashes),
this code is executed in a separate thread.

Does the FlushInstructionCache call work OK with threads?

Any ideas on this would be really welcome.

Thanks,
Toby.



Relevant Pages

  • Re: How to set up a Linux machine that occupies the minimum memory footprint ?
    ... Of course, if you use 8GB of RAM, or more precisely if you ... Are you saying that if I have a 4GB RAM memory, ... Linux will somehow "know" that it doesn't have ... You've said in another message that your app is ...
    (comp.os.linux.setup)
  • Re: How to set up a Linux machine that occupies the minimum memory footprint ?
    ... Of course, if you use 8GB of RAM, or more precisely if you ... Are you saying that if I have a 4GB RAM memory, ... Linux will somehow "know" that it doesn't have ... You've said in another message that your app is ...
    (comp.os.linux.misc)
  • Re: Large text file - in memory ( > 60mb)
    ... The file is over 64mb in size, reading it line by line to do a search ... while running the app, it would mean reading/searching the>64mb file many ... Then I have to show this record found (wich ... maybe creating a datatable to ease the search but I'm pretty sure memory ...
    (microsoft.public.dotnet.framework)
  • Re: Application Unexpectedly Terminates
    ... Do you have access to eVC? ... the JIT will catch it and prompt you to attach eVC to the process. ... I suspected it was a memory problem after reading the documentation. ... The current app is usually last to die, ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: out of memory
    ... I have connections, and IO streams, ... it is possible to Manage to write your own custom Managed Memory ... >> Management and Garbage Collection is not to allow you more time to play ... you probably didn't put the app under any stress. ...
    (microsoft.public.dotnet.framework.aspnet)