ERROR_NO_SYSTEM_RESOURCES ???

Started by
5 comments, last by iMalc 19 years, 3 months ago
I'm having a problem with an ap. It writes out to a file. It runs fine for a while. Then it stops working. At the point it calls CreateFile, the func returns ERROR_NO_SYSTEM_RESOURCES. What causes this error (alot to ask; there's probably a million)? The app is constantly opening and closing the same file to write to it. However, the handle is being closed. The app's memory usage does not look too bad. Nothing extreme. Thanks for any help.
Advertisement
You'll probably have to post some source code if you want people to give you any useful help as at the moment yeah I think it could be anything. Also what language your using could be helpful:)
Quote:Original post by BosskIn Soviet Russia, you STFU WITH THOSE LAME JOKES!

char msg[256];
while(app_running)
{
if((hFile == NULL) && (MsgQueueCount > 0))
{

hFile = CreatFile(...., OPEN_ALWAYS);

PopMsgFromQueue(&msg);
WriteFile(hFile, msg..);


CloseHandle(hFile);

hFile = NULL;
}
}

Hi,

It does not seems to come from the file management code. What do this PopMsgFromQueue(&msg); does? Do you have any other resource manipulator?

If you can't find anything, I suggest you to try sysinternal utilities. They are the programmer's best friends...

Regards,
OTOH, re-opening and closing the file every iteration of the main game loop may not be the smartest thing to do, even if it should work in theory :/
I wanted a user to be able to open the file via notepad while app was still running and writing to file. I tried to call CreateFile with different flags but couldn't get it to work. Notepad would give error message saying another app had access to file. Am I missing something? I agree it does not seem too good to constantly open and close.
I think you need to set dwShareMode to FILE_SHARE_READ in CreateFile so that you can open it in notepad while your app has it open.
"In order to understand recursion, you must first understand recursion."
My website dedicated to sorting algorithms

This topic is closed to new replies.

Advertisement