The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> C Programming
|
Page 2 -
Maximum matrix size
Page 2 - Discuss Maximum matrix size in the C Programming forum on Dev Shed. Maximum matrix size C programming forum discussing all C derivatives, including C#, C++, Object-C, and even plain old vanilla C. These languages are low level languages, and used on projects such as device drivers, compilers, and even whole computer operating systems.
|
|
 |
|
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

April 12th, 2003, 01:07 AM
|
 |
Banned ;)
|
|
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
|
|
|
Yep, I duplicated your problem when I changed F to 25. I think that you've reached a compiler limitation. Here's the problem:
When F=25,
ftV has 26 * 26 * 26 *1024 elements
Now ftV is of type Extended, which means that each element takes 10 bytes of memory.
Hence, total memory taken by the declaration of ftV is
ftV Mem Size = 26 * 26 * 26 * 1024 * 10
= 179978240 bytes
= 0xABA4000 bytes in hex.
Now, if you go to Project --> Options --> Linker, the max heap size (or max. stack size) it allows you to set is 0x1000000. Unfortunately this is less than 0xABA4000, so your compiler can't allocate this memory for you. You might want to talk to borland about it.
|

April 13th, 2003, 02:19 PM
|
 |
Contributing User
|
|
Join Date: Mar 2003
Location: currently Lisbone, Portugal
Posts: 154
Time spent in forums: 22 h 28 m
Reputation Power: 11
|
|
|
welcome back, sorry for late writing but I had to move from Portugal back to Poladn and it took three days. Quite a long way to go.
I am really grateful for Your help. Now that I know what the problems is exactly, I might try contacting that guys at Borland. Perhaps they might works somethign out to fix this problem.
Perhaps changing the type of matrix into float might fix the problem, though then the results I get are not as exact as I want them to be, such probabilites are usually very small so I need all the precision I get.
Thanks once again. I will let You knwo what they repond to my question.
Best greets
MArek
|

April 14th, 2003, 07:46 AM
|
 |
jasondoucette.com
|
|
Join Date: Feb 2003
Location: Canada
Posts: 378

Time spent in forums: 7 h 23 m 8 sec
Reputation Power: 11
|
|
Quote: Originally posted by Scorpions4ever
... Now, if you go to Project --> Options --> Linker, the max heap size (or max. stack size) it allows you to set is 0x1000000. Unfortunately this is less than 0xABA4000, so your compiler can't allocate this memory for you. You might want to talk to borland about it. | I just attempted to compile a program that requires over 300 MB of data (for a legit reason - I am using pre-calc tables for optimizations), and it gives the following error (MSVC++ 6.0):
warning LNK4084: total image size 387477504 exceeds max (268435456); image may not run
The program runs as expected on my system (WinXP), but I wondered why it's saying "image may not run". I did a search for the Internet for this error, which doesn't have much on it, but I did find this page:
http://h18009.www1.hp.com/fortran/kb/q1019.html
And it states:
" Windows 95 and Windows NT 4.0 have a limit for the total size of static code and data of 256MB. If the amount of static code and data exceeds this size, the image may not execute. This is a limitation in the operating system and not in Visual Fortran or its tools. ... If the actual image size is displayed as a negative value, that means that the image size exceeds 2GB and your program will not run on any version of 32-bit Windows."
which implies the same is also true for Visual C++ (i.e. it is a limit of the OS, and not the compiler)
It also states: " Solution: For Windows NT 4.0, install Microsoft's Windows NT Service Pack 3 (or later). This raises the limit on static code and data to 1.75GB. However, the linker is not modified by this update and will continue to issue the warning, which can be ignored. The limit on Windows 98, Windows 2000 and Windows XP is 1.75GB, the same as Windows NT 4.0 with Service Pack 3 - if your application will be not be running on Windows 95, or on Windows NT 4.0 prior to SP3, and the actual image size is not displayed as a negative value, you can ignore this message. ... For Windows 95, Microsoft has not released an update which raises the limit."
So, it sounds like the limit is not 256 MB if you have the right OS, although you will still get the linker error. I have not tested my program on a Win95 machine to see if it works or not.
NOTE: if you dynamically allocate the memory, this limitation does NOT exist.
|

April 14th, 2003, 01:43 PM
|
 |
Contributing User
|
|
Join Date: Mar 2003
Location: currently Lisbone, Portugal
Posts: 154
Time spent in forums: 22 h 28 m
Reputation Power: 11
|
|
|
Welcome back
so the ides seems to be: just install the SP3 for WIn2000 and forget about the error, becasue it will be presented but the exe file should work. Well, it does not since it is created just partially. Teh size is too small for it to be complete.
I also tried allocating the memory dynamically and all I got was "error in the Vmem.c library. Abnormal program termination".
Got that twice.
Perhaps You could write me how to allocate that? Perhaps I do that in a wronf way or something. I am running out of ideas.
Thanks a lot
Best wishes
Marek
|

April 14th, 2003, 05:02 PM
|
 |
jasondoucette.com
|
|
Join Date: Feb 2003
Location: Canada
Posts: 378

Time spent in forums: 7 h 23 m 8 sec
Reputation Power: 11
|
|
|
Remember, the warning I showed you above is a linker warning, not an error. It compiles, and it links into an .exe. The problem lies in whether or not your OS can run it. Some can, and some can't. Read my previous post to see which can.
If this is the only warning you are getting, and you have an OS that can run it properly, then you do not have a problem (unless you plan on giving your software to people who do not have the appropriate OS). If this is NOT the only warning (or if you are getting errors), then you have more problems than this.
If this size limit does not exist for dynamic allocation, you should be able to use the new operator as you would normally use it for arrays, and it should work.
|

April 14th, 2003, 11:41 PM
|
 |
Contributing User
|
|
Join Date: Mar 2003
Location: currently Lisbone, Portugal
Posts: 154
Time spent in forums: 22 h 28 m
Reputation Power: 11
|
|
|
I understand.
The problem is I receive a linker error on Windows2000 with SP3, which according toYour post should have such problem elliminated. Maybe I will just stick to lower matrix sizes, to lets's say 10x10x10x1024, the proffessor is not going to kill me for that after all.
Thank You for all Your help. It was priceless.
Best regards
Marek
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|