View previous topic :: View next topic |
Author |
Message |
KennyT
Joined: 02 Aug 2005 Posts: 318
|
Posted: Mon Jan 17, 2011 11:18 am Post subject: How do I find out the size of an allocatable structure? |
|
|
I have a situation where some code works on my WinXP development machine but fails on my customers W2003 server. The program crashes in the "ALLOCATE" statement (despite it having a STAT= attribute). So, I want to check how much memory it is attempting to allocate (just to make sure that its not trying to allocate an "undefined" or "negative" size etc).
How can I do it? I thought "SIZE" might do it, but that just comes back with zero...
TIA
K |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Mon Jan 17, 2011 12:32 pm Post subject: |
|
|
If you are allocating an array, does the SIZE intrinsic function give you a sensible result?
If you are nearing the 32bit integer limit for the size, you may need a recent version of the compiler to get a good result from ALLOCATE. |
|
Back to top |
|
 |
KennyT
Joined: 02 Aug 2005 Posts: 318
|
Posted: Mon Jan 17, 2011 1:22 pm Post subject: |
|
|
Sorry, should have made it clear in the text (not just the subject!). It's a structure, not an array.
K |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Mon Jan 17, 2011 1:34 pm Post subject: |
|
|
I am not sure but can you use INQUIRE in this context? |
|
Back to top |
|
 |
KennyT
Joined: 02 Aug 2005 Posts: 318
|
Posted: Mon Jan 17, 2011 1:50 pm Post subject: |
|
|
That looks to have done it, thanks.
K |
|
Back to top |
|
 |
|