Click here to Skip to main content
13,052,163 members (38,275 online)
Rate this:
Please Sign up or sign in to vote.
See more:

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


Posted 6-May-13 8:15am
It could be. I would say, not enough information to solve the problem.
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.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

"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."

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 ?
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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


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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 7 May 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100