Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29277 Discussions

Memory management problem on loading of executable

michael_green
Beginner
585 Views

Hi All,

I have a standard Windows application built using default settings. I and my users are all using Windows XP. When the program loads it displays a flash bitmap and a menu, then waits for a user menu choice. Occasionally on loading, it displays the bitmap and menu then immediately crashes. This happens rarely on my machine, on about 1 in 10 attempts on some machines, and on one particular machine it happens more often than not, though not every time.

I have checked out memory usage with Windows Task Manager and seen that on a normal load memory usage is about 7300K, dropping to about 450K on window minimisation. But when the program is going to crash, memory usage shoots up to around 58000K. This is the same executable every time, and I can sometimes run 3 instances on the one machine with no probelms, then on the 4th it crashes, and then I try again and it's fine.

Does anyone have any suggestions as to what might be going on? I'd be very grateful for any insight at all.

With many thanks in advance,

Mike

0 Kudos
4 Replies
ZlamalJakub
New Contributor III
585 Views

what do you mean that program crashes, some error message?

Are you using allocatble arrays you deallocate after initialisation? Is not problem with temporary big memory consumption which widnows cannot give to your application. (If you have 200M of free memory, it does not mean that when you need 50M you obtain it (because there should not be 50M continuos memory block). Do you test if memory allocation is successfull?

Are you calling any external libraries (dll?). There can be problem with stack corruption or extra memory consumption of these dlls.

Did you tried to remove flash bitmap display from your code?

Jakub

0 Kudos
IDZ_A_Intel
Employee
585 Views

Does any error message appear when it "crashes"?

This past two weeks I have had a problem with an exe failing every time on startup onmy system but it worked ok on my colleagues systems. We compared system dll dates, environment variables, service pack levels - everything we could think of. Eventually (yesterday)our hardware dept replaced my graphics card and so far all apears ok.

Les

0 Kudos
michael_green
Beginner
585 Views

Hi Guys,

Your questions made me check out a few things carefully, and I found that the problem went away when I disabled a certain DLL. I have now sidestepped the problem by running the DLL in its own thread, but I really can't see why this was necessary - any suggestions? The DLL and now its thread are run under WM_CREATE.

Many thanks for your replies,

Mike

0 Kudos
ZlamalJakub
New Contributor III
585 Views

I think that each thread have its own stack. If your dll allocates too much memory on stack (or uses too deep recursion of routines), it can corrupt it. If you run dll from your exe they share one stack and there can be not enough space. Try to compile your code with bigger stack. Default stack is about 1MB i think.

Jakub

0 Kudos
Reply