Click here to Skip to main content
15,886,578 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi,

I have a program that duplicates a dll and loads it multiple times.

in the 7th loadlibrary command the operation failed with the failure - "not enough storage" (error code 8)

i am loading 4 dll's, then release them (freelibrary) and load them again

I have win 7 with 8 GB of memory and working in VS2008 writing in c/c++

when i look at the task manager i don't see anything unusual may be i am not looking in the right place, the memory usage of the application doesn't exceed 1,300,000 KB

if i run the app with 6 loadlibary commands it works ok.

Could It be a problem in the dll?

I thought my PC is rather strong and it should be able to stand in memory demands.

I am trying to solve this problem for 3 days.

hope someone can help me

thanks

dj4400
Posted
Comments
Sergey Alexandrovich Kryukov 6-May-13 15:43pm    
It could be. I would say, not enough information to solve the problem.
—SA
Sergey Alexandrovich Kryukov 8-May-13 18:04pm    
Please stop posting non-answers as "solution". It can give you abuse reports which eventually may lead to cancellation of your CodeProject membership.
Comment on any posts, reply to available comments, or use "Improve question" (above).
Also, keep in mind that members only get notifications on the post sent in reply to there posts.
—SA

"I have a program that duplicates a dll and loads it multiple times." What ???

Do you copy the DLL and then call LoadLibrary ?

The same dll would not be loaded several times by the same Process.

MSDN says:
"For each DLL that has not already been called, the system calls the DLL's entry-point function.
This call is made in the context of the thread that caused the process address space to change,
such as the primary thread of the process or the thread that called LoadLibrary.
...
Threads in DllMain hold the loader lock so no additional DLLs can be dynamically loaded or initialized."

http://msdn.microsoft.com/en-us/library/windows/desktop/ms682583.aspx

If the Problem occurs after loading the same DLL several times with LoadLibrary() something
must go wrong inside your DLL.

What does the DLL do and why are you loading it several times ?
 
Share this answer
 
 
Share this answer
 
Comments
dj4400 7-May-13 15:53pm    
I opened LaxmikantYadav link but it talks about delphi and XP. i am working on win 7 and c++ so i don't think their solution is relevant.
The third solution they offered talked about atom table - i don't know if it exists in c++.
dj4400 7-May-13 15:56pm    
Is there a way to monitor the memory shortage - may be i am not looking on the right place in the task manager - i looked at the memory usage and the peak memory usage and saw only results mentioned above.

Also, is there a way to see if i am excessively using some other resources such as the DC they mentioned in the link

thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900