Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C++ C
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 9:15am
Sergey Alexandrovich Kryukov at 6-May-13 15:43pm
It could be. I would say, not enough information to solve the problem.
Sergey Alexandrovich Kryukov at 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.
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 at 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 at 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
0 OriginalGriff 685
1 Maciej Los 290
2 Richard Deeming 185
3 Suvendu Shekhar Giri 184
4 Abhinav S 166
0 Sergey Alexandrovich Kryukov 9,678
1 OriginalGriff 9,135
2 Peter Leow 5,082
3 Kornfeld Eliyahu Peter 3,373
4 Maciej Los 2,606

Advertise | Privacy | Mobile
Web04 | 2.8.150327.1 | Last Updated 7 May 2013
Copyright © CodeProject, 1999-2015
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