For Programmers: Free Programming Magazines  


Home > Archive > Fortran > September 2005 > Access violation after nullifiying and again allocating pointer









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Access violation after nullifiying and again allocating pointer
Klemens Barfus

2005-09-08, 7:58 am

Dear list members,

working on a programm which calculates varying atmospheric profiles, I
have a subroutine where the profile is stored in a pointer called
'profile'. Within this profile, there ia a pointer array called 'level'
with parameter like temperature, pressure, etc.
When I calculate the profile for the next gridcell, I nullify first the
profile to get rid of the old data.
This works fine, until there is an access violation. The appearance of
this access violation seems to be independent of the data used in this
moment.

A part of the code is shown below:


if(associated(profile))then
nullify(profile)
endif
allocate(profile)
! calculation of number of levels
profile%anz_z = INT((cloudtop - cloudbase)/dz) + 5
allocate(profile%level(1:profile%anz_z))



Access violation occurs always in the last allocation statement.

Any suggestions ?

Thanks for your help in advance !

Klemens

p.s.: I work with the Developer Studio 97 and Visual Fortran 5.0
Jan Vorbrüggen

2005-09-08, 6:59 pm

You should be aware that nullifying the pointer does _not_ deallocate
the memory that now, possibly, has become inaccessible to the program.
Of course, a deallocate also nullifies the pointer. So, perhaps you
program is running out of memory, and VF 5's RTL is unkind in just
crashing instead of providing a useful error message?

BTW, VF 5 is....well...old. Why not use, for instance, the non-commercial
license for the Intel compiler? There was some strange wording in that
license recently with regard to academic, though...

Jan
Klemens Barfus

2005-09-08, 6:59 pm

Thanks for your answer, Jan !

Now I have checked the runtime error, which appears when allocating the
pointer array, where the proramm crashes. It is runtime error 41 - which
means that there is not enough virtual memory.
But it appears if I replace the nullify with a deallocate, too.

Klemens

Jan Vorbrüggen wrote:
> You should be aware that nullifying the pointer does _not_ deallocate
> the memory that now, possibly, has become inaccessible to the program.
> Of course, a deallocate also nullifies the pointer. So, perhaps you
> program is running out of memory, and VF 5's RTL is unkind in just
> crashing instead of providing a useful error message?
>
> BTW, VF 5 is....well...old. Why not use, for instance, the non-commercial
> license for the Intel compiler? There was some strange wording in that
> license recently with regard to academic, though...
>
> Jan

Jan Vorbrüggen

2005-09-08, 6:59 pm

> But it appears if I replace the nullify with a deallocate, too.

So there might be other places where you produce memory leaks. Anybody
using pointers is likely to, at least initially, have some in their
program.

Get yourself a compiler supporting the ALLOCATABLE TR, and change the
pointers to allocatables everywhere you can (which should be a very large
fraction of the extant population). That should improve things considerably.

Jan
Steve Lionel

2005-09-08, 6:59 pm

On Thu, 08 Sep 2005 15:18:51 +0200, Jan Vorbrüggen
<jvorbrueggen-not@mediasec.de> wrote:

>BTW, VF 5 is....well...old. Why not use, for instance, the non-commercial
>license for the Intel compiler? There was some strange wording in that
>license recently with regard to academic, though...


There isn't an Intel compiler non-commercial license on Windows. There are
student and academic licenses.

Steve Lionel
Software Products Division
Intel Corporation
Nashua, NH

User communities for Intel Software Development Products
http://softwareforums.intel.com/
Intel Fortran Support
http://developer.intel.com/software/products/support/
kia

2005-09-10, 3:56 am

Steve Lionel wrote:
>
> There isn't an Intel compiler non-commercial license on Windows. There are
> student and academic licenses.


No they aren't, no more than any software running in dos/box is.
Therefore, pack your bags, and run on to your legal dept to phrase
retractions for *all* egregious claims you've been making. A quick
primer for you (read with extreme care!):

The Federal Trade Commission Act allows the FTC to act in the interest
of all consumers to prevent deceptive and unfair acts or practices. In
interpreting Section 5 of the Act, the Commission has determined that a
representation, omission or practice is deceptive if it is likely to:

mislead consumers and affect consumers' behavior or
decisions about the product or service.

In addition, an act or practice is unfair if the injury it causes, or is
likely to cause, is:

substantial
not outweighed by other benefits and
not reasonably avoidable.

The FTC Act prohibits unfair or deceptive advertising in any medium.
That is, advertising must tell the truth and not mislead consumers. A
claim can be misleading if relevant information is left out or if the
claim implies something that's not true.

Gib Bogle

2005-09-10, 3:56 am

kia wrote:
> Steve Lionel wrote:
>
>
>
> No they aren't, no more than any software running in dos/box is.


Who, or what, aren't what? And software running in a dos/box is what?
And what is a "dos/box"?
Richard Maine

2005-09-10, 6:58 pm

In article <dftvn8$mm4$1@lust.ihug.co.nz>,
Gib Bogle <bogle@ihug.too.much.spam.co.nz> wrote:

> kia wrote:
>
> Who, or what, aren't what? And software running in a dos/box is what?
> And what is a "dos/box"?


When I wondered about the same questions, my best guess was that this
curious fragment was intended to be an illustration of deceptiveness in
that it gives the illusion of meaning without actually having any. :-)
Brooks Moses

2005-09-10, 6:58 pm

Richard Maine wrote:
> In article <dftvn8$mm4$1@lust.ihug.co.nz>,
> Gib Bogle <bogle@ihug.too.much.spam.co.nz> wrote:
>
> When I wondered about the same questions, my best guess was that this
> curious fragment was intended to be an illustration of deceptiveness in
> that it gives the illusion of meaning without actually having any. :-)


Either that, or our erstwhile "Intel Fortran isn't Visual" complainers
on comp.lang.fortran have gotten to the point where they have knee-jerk
reactions to any mention of the compilers at all (regardless of whether
it includes the "Visual" part of the name or not), and also have gotten
to the point of completely forgetting to explain their objection. That
would at least explain the "dos/box" bit (which I take to be a strangely
puncuated and capitalized reference to a command.com shell window)....

- Brooks


--
The "bmoses-nospam" address is valid; no unmunging needed.
Rich Townsend

2005-09-10, 6:58 pm

Brooks Moses wrote:
> Richard Maine wrote:
>
>
>
> Either that, or our erstwhile "Intel Fortran isn't Visual" complainers
> on comp.lang.fortran have gotten to the point where they have knee-jerk
> reactions to any mention of the compilers at all (regardless of whether
> it includes the "Visual" part of the name or not), and also have gotten
> to the point of completely forgetting to explain their objection. That
> would at least explain the "dos/box" bit (which I take to be a strangely
> puncuated and capitalized reference to a command.com shell window)....


I agree completely, with one exception: you should have written
"complainer" instead of "complainers", since it is only B. Voh
(childishly posting under pseudonyms) who seems to make a fuss. Why this
individual has so much animosity toward Intel is puzzling. My guess is
that he tied his product (SDX) to the Compaq Visual Fortran compiler,
and is now reaping the whirlwind of this poor strategic decision.

cheers,

Rich
Gary L. Scott

2005-09-10, 6:58 pm

Rich Townsend wrote:
> Brooks Moses wrote:
>
>
>
> I agree completely, with one exception: you should have written
> "complainer" instead of "complainers", since it is only B. Voh
> (childishly posting under pseudonyms) who seems to make a fuss. Why this
> individual has so much animosity toward Intel is puzzling. My guess is
> that he tied his product (SDX) to the Compaq Visual Fortran compiler,
> and is now reaping the whirlwind of this poor strategic decision.
>
> cheers,
>
> Rich

Well, there are quite a few that are disappointed that IVF is overall a
lesser product than CVF, out of the box. You can do extra work to make
it roughly equivalent, but a high quality product would not make you do so.

--

Gary Scott
mailto:garyscott@ev1.net

Fortran Library: http://www.fortranlib.com

Support the Original G95 Project: http://www.g95.org
-OR-
Support the GNU GFortran Project: http://gcc.gnu.org/fortran/index.html

Why are there two? God only knows.


If you want to do the impossible, don't hire an expert because he knows
it can't be done.

-- Henry Ford
Rich Townsend

2005-09-10, 6:58 pm

Gary L. Scott wrote:
> Rich Townsend wrote:
>
>
> Well, there are quite a few that are disappointed that IVF is overall a
> lesser product than CVF, out of the box. You can do extra work to make
> it roughly equivalent, but a high quality product would not make you do so.
>


What, then, exactly is missing? Coming from the UN*X side of things,
I've never seen any of the 'Visual' stuff, so it is difficult to compare
CVF and IVF (here, I note that the Intel compiler for Linux is not 'IVF'
but just 'Intel Fortran for Linux', in just the same way that I had
'Compaq Fortran for Tru64' rather than 'CVF' on the Alphas I used to use).

cheers,

Rich
Richard E Maine

2005-09-12, 6:58 pm

In article <11i6jujrlffa82@corp.supernews.com>,
"Gary L. Scott" <garyscott@ev1.net> wrote:

> Well, there are quite a few that are disappointed that IVF is overall a
> lesser product than CVF, out of the box.


But being disappointed is majorly different from the kind of
single-minded harping illustrated by one poster this thread, where it
turns into random and incoherent snide comments on postings that have
nothing to do with the "visual" features, not-so-veiled (but
implausible) threats of legal action, and other childish behavior.

I have disappointments about many things, some even related to the
DVF/CFV/I(V)F family of compilers. But I long ago learned how to express
disappointment without throwing a temper tantrum. I'm hopeful that my
14-year-old daughter might be learning that soon also; I'm at least
seeing signs of improvement. :-)

--
Richard Maine | Good judgment comes from experience;
email: my first.last at org.domain | experience comes from bad judgment.
org: nasa, domain: gov | -- Mark Twain
Dick Hendrickson

2005-09-12, 6:58 pm



Richard E Maine wrote:
> In article <11i6jujrlffa82@corp.supernews.com>,
> "Gary L. Scott" <garyscott@ev1.net> wrote:
>
>
>
>
> But being disappointed is majorly different from the kind of
> single-minded harping illustrated by one poster this thread, where it
> turns into random and incoherent snide comments on postings that have
> nothing to do with the "visual" features, not-so-veiled (but
> implausible) threats of legal action, and other childish behavior.
>
> I have disappointments about many things, some even related to the
> DVF/CFV/I(V)F family of compilers. But I long ago learned how to express
> disappointment without throwing a temper tantrum. I'm hopeful that my
> 14-year-old daughter might be learning that soon also; I'm at least
> seeing signs of improvement. :-)

And, if she's a regular c.l.f reader, you might soon see a
sign of regression!

Dick Hendrickson
>


Richard E Maine

2005-09-12, 6:58 pm

In article <xFiVe.234173$5N3.80631@bgtnsc05-news.ops.worldnet.att.net>,
Dick Hendrickson <dick.hendrickson@att.net> wrote:

> Richard E Maine wrote:
>... my 14-year-old daughter...
> And, if she's a regular c.l.f reader, you might soon see a
> sign of regression!


Afraid I'm a failure as a parent. None of my kids do Fortran. :-)

My eldest son at least knows a little Fortran, but not much. He actually
was teaching some C in one of his high school classes; I accused him of
contributing to the delinquency of minors. Above 14-year-old daughter
doesn't have much interest in programming at all; I once tried teaching
her some, but we didn't get much past "hello, world" and trivial
expressions on literal constants before the "boredom with it all"
overwhelmed her. The severely handicapped 19-year-old probably needs to
get past about 6 words of English before I have much chance at Fortran.
:-(

--
Richard Maine | Good judgment comes from experience;
email: my first.last at org.domain | experience comes from bad judgment.
org: nasa, domain: gov | -- Mark Twain
Chris Hulbert

2005-09-12, 6:58 pm


Richard E Maine wrote:
> In article <xFiVe.234173$5N3.80631@bgtnsc05-news.ops.worldnet.att.net>,
> Dick Hendrickson <dick.hendrickson@att.net> wrote:
>
>
> Afraid I'm a failure as a parent. None of my kids do Fortran. :-)
>
> My eldest son at least knows a little Fortran, but not much. He actually
> was teaching some C in one of his high school classes; I accused him of
> contributing to the delinquency of minors. Above 14-year-old daughter
> doesn't have much interest in programming at all; I once tried teaching
> her some, but we didn't get much past "hello, world" and trivial
> expressions on literal constants before the "boredom with it all"
> overwhelmed her. The severely handicapped 19-year-old probably needs to
> get past about 6 words of English before I have much chance at Fortran.
> :-(
>
> --
> Richard Maine | Good judgment comes from experience;
> email: my first.last at org.domain | experience comes from bad judgment.
> org: nasa, domain: gov | -- Mark Twain


Be nice to C programmers :P! Could be worse, I (22) spend $2k on
computing power for number crunching; all my friends spend $2k+ so Doom
and the like will run better.

DBrown

2005-09-12, 6:58 pm

Richard E Maine wrote:
>
> In article <11i6jujrlffa82@corp.supernews.com>,
> "Gary L. Scott" <garyscott@ev1.net> wrote:
>
>
> But being disappointed is majorly different from the kind of
> single-minded harping illustrated by one poster this thread, where it
> turns into random and incoherent snide comments on postings that have
> nothing to do with the "visual" features, not-so-veiled (but
> implausible) threats of legal action, and other childish behavior.


Are you implying that Bush staffed FTC with the same kind of idiots as
FEMA? Being a Gvt mold yourself, you didn't know?

FEMA was a disaster waiting to happen, the minute a disaster struck.
As The Washington Post reported Friday, five of the eight top FEMA
officials were simply Bush loyalists and political operatives who
"came to their posts with virtually no experience in handling
disasters."

Next time try to get educated before you slobber clf with another of
your inane utterances. Have a nice day [loafing around on taxpayers
time]!
Rich Townsend

2005-09-12, 6:58 pm

DBrown wrote:
> Richard E Maine wrote:
>
>
>
> Are you implying that Bush staffed FTC with the same kind of idiots as
> FEMA? Being a Gvt mold yourself, you didn't know?
>
> FEMA was a disaster waiting to happen, the minute a disaster struck.
> As The Washington Post reported Friday, five of the eight top FEMA
> officials were simply Bush loyalists and political operatives who
> "came to their posts with virtually no experience in handling
> disasters."
>
> Next time try to get educated before you slobber clf with another of
> your inane utterances. Have a nice day [loafing around on taxpayers
> time]!


Go away Voh, you bitter little man.

Harold Stevens

2005-09-12, 6:58 pm

In <4325E73D.DC5FAABF@stormed.com> DBrown:

[Snip...]

> Next time try to get educated before you slobber clf


<PLONK>

--
Regards, Weird (Harold Stevens) * IMPORTANT EMAIL INFO FOLLOWS *
Pardon any bogus email addresses (wookie) in place for spambots.
Really, it's (wyrd) at airmail, dotted with net. DO NOT SPAM IT.
Kids jumping ship? Looking to hire an old-school type? Email me.
Richard Maine

2005-09-12, 9:57 pm

In article <4325E73D.DC5FAABF@stormed.com>,
Voh, ashamed to write under his own name, wrote:

[much "relevant" and "insightful" material elided]

> Are you implying that Bush staffed FTC with the same kind of idiots as
> FEMA? Being a Gvt mold yourself...


I think I was just accused of being a Bush political appointee. :-(

Ah, for the good old days of Usenet, where the worst insults one had to
endure were something along the lines of pedophilia, along with a few
vulgarities, racial slurs, and the like. :-)
Rich Townsend

2005-09-12, 9:57 pm

Richard Maine wrote:
> In article <4325E73D.DC5FAABF@stormed.com>,
> Voh, ashamed to write under his own name, wrote:
>
> [much "relevant" and "insightful" material elided]
>
>
>
>
> I think I was just accused of being a Bush political appointee. :-(
>
> Ah, for the good old days of Usenet, where the worst insults one had to
> endure were something along the lines of pedophilia, along with a few
> vulgarities, racial slurs, and the like. :-)


I liked the accusations of puppy kicking the most - real class.
GF Thomas

2005-09-13, 3:57 am


"Richard Maine" <nospam@see.signature> wrote in message
news:nospam-109E0F.18035812092005@news.supernews.com...
> In article <4325E73D.DC5FAABF@stormed.com>,
> Voh, ashamed to write under his own name, wrote:
>
> [much "relevant" and "insightful" material elided]


What's a Voh?, no matter.

>
>
> I think I was just accused of being a Bush political appointee. :-(
>
> Ah, for the good old days of Usenet, where the worst insults one had to
> endure were something along the lines of pedophilia, along with a few
> vulgarities, racial slurs, and the like. :-)


It's clear that the Andy Capp of clf is a queer, sycophantic, pedophiliac
nigger of someone's fancy. What'd bet (s)he's yours.

--
Gerry T.
______
"Is it not strange that desire should so many years outlive performance?"
Poins, in Henry IV, Part II



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com