Silverfrost Forums

Welcome to our forums

How do I find out the size of an allocatable structure?

17 Jan 2011 10:18 #7513

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

17 Jan 2011 11:32 #7515

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.

17 Jan 2011 12:22 #7516

Sorry, should have made it clear in the text (not just the subject!). It's a structure, not an array.

K

17 Jan 2011 12:34 #7517

I am not sure but can you use INQUIRE in this context?

17 Jan 2011 12:50 #7519

That looks to have done it, thanks.

K

Please login to reply.