Thread View: borland.public.cppbuilder.nativeapi
7 messages
7 total messages
Started by nagoyadam
Thu, 07 Jun 2007 06:10
Loadlibrary failure for DLL with large mem req.
Author: nagoyadam
Date: Thu, 07 Jun 2007 06:10
Date: Thu, 07 Jun 2007 06:10
11 lines
1702 bytes
1702 bytes
Hi Thanks in advance for any help I have a DLL written in Fortran and I know that very large matrices is used in it. My problem is that I can not load this DLL using LoadLibrary, however if I linked the DLL's lib file with my program I have no problems. Since it uses very huge memory I would like to load it on demand. Any idea of how to do it?
Re: Loadlibrary failure for DLL with large mem req.
Author: Dmitry
Date: Thu, 07 Jun 2007 06:40
Date: Thu, 07 Jun 2007 06:40
11 lines
1207 bytes
1207 bytes
> My problem is that I can not load this DLL using LoadLibrary, however > if I linked the DLL's lib file with my program I have no problems. > Since it uses very huge memory I would like to load it on demand. Hi, please check weather dependent libraries loaded to memory before you load your dll. Dmitry
Re: Loadlibrary failure for DLL with large mem req.
Author: nagoyadam
Date: Thu, 07 Jun 2007 06:48
Date: Thu, 07 Jun 2007 06:48
14 lines
1986 bytes
1986 bytes
On Jun 7, 3:40 pm, "Dmitry" <dmi...@pikalevo.com> wrote: > > My problem is that I can not load this DLL using LoadLibrary, however > > if I linked the DLL's lib file with my program I have no problems. > > Since it uses very huge memory I would like to load it on demand. > > Hi, > > please check weather dependent libraries loaded to memory before you load > your dll. > > Dmitry I think that the only dependent library is that DLL since I do not use RTL or any other DLLs
Re: Loadlibrary failure for DLL with large mem req.
Author: Bob Gonder
Date: Thu, 07 Jun 2007 16:12
Date: Thu, 07 Jun 2007 16:12
19 lines
1616 bytes
1616 bytes
nagoyadam wrote: >I have a DLL written in Fortran and I know that very large matrices is >used in it. >My problem is that I can not load this DLL using LoadLibrary, Did you check the error code? >if I linked the DLL's lib file with my program I have no problems. >Since it uses very huge memory I would like to load it on demand. My guess is that there isn't enough contiguous memory for the dll. But if the linker knows about it, memory is set aside and other dlls are shifted around to make room. >Any idea of how to do it? You might try setting the dll as "Delay Load" In your code, you treat it as a normal preloaded dll.
Re: Loadlibrary failure for DLL with large mem req.
Author: nagoyadam
Date: Fri, 08 Jun 2007 00:40
Date: Fri, 08 Jun 2007 00:40
26 lines
2340 bytes
2340 bytes
Thank you very much for your reply > Did you check the error code? The error message I receive is "Not enough storage is available to process this command" I have 3GB RAM on my machine, and the DLL requires around 600MB > My guess is that there isn't enough contiguous memory for the dll. > But if the linker knows about it, memory is set aside and other dlls > are shifted around to make room. The DLL has a large matrix used internally and not exported can the linker know about it? > >Any idea of how to do it? > > You might try setting the dll as "Delay Load" > In your code, you treat it as a normal preloaded dll. Using delay load I receive "external exception C0FB007E" when calling the DLL. I was able to run the program on Vista machine with 2GB RAM, but the problem remains on XP.
Re: Loadlibrary failure for DLL with large mem req.
Author: Bob Gonder
Date: Mon, 11 Jun 2007 17:14
Date: Mon, 11 Jun 2007 17:14
39 lines
2547 bytes
2547 bytes
nagoyadam@gmail.com wrote: >The error message I receive is "Not enough storage is available to >process this command" I have 3GB RAM on my machine, RAM isn't the issue. > and the DLL requires around 600MB That could well be the issue. Programs are only alotted 2 GB of "space" in which to run. Your program loads at the 4 MB mark. Above that is your code, data, uninitialized data. Above that, DLLs are loaded in a free-for-all. wherever they can fit. First come, first served. Then too, each thread that spawns after startup takes another MB for it's stack. Plus any allocated/fragmented data And the memory manager takes a hunk of what's left over so it doesn't need to keep asking the OS for memory. By loading your DLL last, it has to make do with whatever is left. Apparently you don't have a contiguous 600MB remaining. Either that, or your DLL has been "based" so it can only go in one position in memory, and some of that area is in use. By letting the startup code manage the loading of your DLL, it can rework the jigsaw puzzle entil everything fits. Then the runtime allocations for thread stack and variables can fit into the nooks and crannies left over. >The DLL has a large matrix used internally and not exported can the >linker know about it? It knows how big the DLL is (well, maybe not the linker, but at least the startup code it generates). You might consider allocating the matrix at runtime if it isn't preinitialized with data.
Re: Loadlibrary failure for DLL with large mem req.
Author: nagoyadam
Date: Wed, 13 Jun 2007 02:09
Date: Wed, 13 Jun 2007 02:09
5 lines
1885 bytes
1885 bytes
Thank you very much Bob. Unfortunately I can not modify the DLL however, I made the program work by creating a special exe that calls the DLL when required and calling that exe using shellexec. If any body can recommend a better solution I will be thankful
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads