Article View: borland.public.cppbuilder.nativeapi
Article #1821Re: Loadlibrary failure for DLL with large mem req.
From: 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.
Technical Details
Message-ID:
<vivq63t697guprpd4v2o76a2fb6fo3llge@4ax.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<1181196641.804110.173150@r19g2000prf.googlegroups.com> <p8bg63p3mipc4u8sdfu91bclt70dsaakv4@4ax.com> <1181263237.328826.324850@g37g2000prf.googlegroups.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,9dbe7f239dea0988 X-Google-Attributes: gid10cc67,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: Bob Gonder <notbg@notmindspring.invalid> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Loadlibrary failure for DLL with large mem req. Date: Mon, 11 Jun 2007 10:14:57 -0700 Organization: MindSpring Enterprises, Inc. Reply-To: notbg@notmindspring.invalid Message-ID: <vivq63t697guprpd4v2o76a2fb6fo3llge@4ax.com> References: <1181196641.804110.173150@r19g2000prf.googlegroups.com> <p8bg63p3mipc4u8sdfu91bclt70dsaakv4@4ax.com> <1181263237.328826.324850@g37g2000prf.googlegroups.com> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 69.69.86.80 X-Trace: newsgroups.borland.com 1181582095 69.69.86.80 (11 Jun 2007 10:14:55 -0700) Lines: 41 Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail