Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ C
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 6-May-13 9:15am
dj4400196
Comments
Sergey Alexandrovich Kryukov at 6-May-13 15:43pm
   
It could be. I would say, not enough information to solve the problem.
—SA
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.
—SA
Rate this: bad
good
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."
 
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 ?
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

  Permalink  
Comments
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
 
thanks

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

  Print Answers RSS
0 George Jonsson 175
1 Kornfeld Eliyahu Peter 169
2 Zoltán Zörgő 139
3 PIEBALDconsult 130
4 OriginalGriff 120
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,107
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,342


Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 7 May 2013
Copyright © CodeProject, 1999-2014
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