comp.lang.ada
 help / color / mirror / Atom feed
* Create-Delete tmp Files
@ 2000-03-17  0:00 Achim Gerhard
  2000-03-17  0:00 ` Robert Dewar
  2000-03-17  0:00 ` John J Cupak Jr
  0 siblings, 2 replies; 21+ messages in thread
From: Achim Gerhard @ 2000-03-17  0:00 UTC (permalink / raw)


Hi all,
is this legal Ada code?
loop
Text_IO.Create ( File => the_file, Mode => Text_IO.OUT_File );
Text_IO.Reset ( File => the_file, Mode => Text_IO.IN_File );
Text_IO.Delete ( File => the_file );
end loop;
The background is:
in an application I use a temporary file. First i create a (noname) file
and write some stuff into that file. After that, I want to read that
stuff. So, I'll open that file as In_File and read from the beginning
(reset...).
Finally I throw away that file (delete).
The main things Create/Reset/Delete are written in the code fragment
above.
I don't see anything illegal in this code, but the Ada runtime seems to
accumulate memory (for file handles?) until ... it throws in the towel.
Any comments?
Hope this will not lead into a discussion 'how2use tmp files' :-)
Regards,
Achim
--
_ _
/A/G


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Create-Delete tmp Files
  2000-03-17  0:00 Create-Delete tmp Files Achim Gerhard
@ 2000-03-17  0:00 ` Robert Dewar
  2000-03-17  0:00 ` John J Cupak Jr
  1 sibling, 0 replies; 21+ messages in thread
From: Robert Dewar @ 2000-03-17  0:00 UTC (permalink / raw)


In article <8at7g0$bhc$1@nnrp1.deja.com>,
  Achim Gerhard <achim_g@my-deja.com> wrote:
> I don't see anything illegal in this code, but the Ada runtime
> seems to accumulate memory (for file handles?)

I don't know what "the Ada runtime" means [always say what
compiler and machine you are using], but it sounds perfectly
reasonable for the Ada runtime to accumulate memory for open
files ... as you keep opening more of them.


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Create-Delete tmp Files
  2000-03-17  0:00 Create-Delete tmp Files Achim Gerhard
  2000-03-17  0:00 ` Robert Dewar
@ 2000-03-17  0:00 ` John J Cupak Jr
  2000-03-18  0:00   ` Robert Dewar
  1 sibling, 1 reply; 21+ messages in thread
From: John J Cupak Jr @ 2000-03-17  0:00 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 1155 bytes --]

Achim,

If you create a file without specifying the name, Ada is supposed to create
a temporary
file which is "automagically" deleted on close. You shouldn't need the
Delete call.

Hope this helps.
John


Achim Gerhard wrote:

> Hi all,
> is this legal Ada code?
> loop
> Text_IO.Create ( File => the_file, Mode => Text_IO.OUT_File );
> Text_IO.Reset ( File => the_file, Mode => Text_IO.IN_File );
> Text_IO.Delete ( File => the_file );
> end loop;
> The background is:
> in an application I use a temporary file. First i create a (noname) file
> and write some stuff into that file. After that, I want to read that
> stuff. So, I'll open that file as In_File and read from the beginning
> (reset...).
> Finally I throw away that file (delete).
> The main things Create/Reset/Delete are written in the code fragment
> above.
> I don't see anything illegal in this code, but the Ada runtime seems to
> accumulate memory (for file handles?) until ... it throws in the towel.
> Any comments?
> Hope this will not lead into a discussion 'how2use tmp files' :-)
> Regards,
> Achim
> --
> _ _
> /A/G
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.

[-- Attachment #2: Card for John J Cupak Jr --]
[-- Type: text/x-vcard, Size: 364 bytes --]

begin:vcard 
n:Cupak Jr;John J
tel;fax:978.858.4336
tel;work:978.858.1222
x-mozilla-html:TRUE
org:Raytheon Company;Northeast Software Training
version:2.1
email;internet:John_J_Cupak@res.raytheon.com
title:Software Engineering Instructor
adr;quoted-printable:;;50 Apple Hill Road=0D=0AT3MN35;Tewksbury;MA;01876;USA
x-mozilla-cpt:;9904
fn:John J Cupak Jr
end:vcard

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Create-Delete tmp Files
  2000-03-17  0:00 ` John J Cupak Jr
@ 2000-03-18  0:00   ` Robert Dewar
  2000-03-20  0:00     ` Achim Gerhard
  0 siblings, 1 reply; 21+ messages in thread
From: Robert Dewar @ 2000-03-18  0:00 UTC (permalink / raw)


In article <38D27008.4055C0AB@res.raytheon.com>,
  John J Cupak Jr <John_J_Cupak@res.raytheon.com> wrote:
> This is a multi-part message in MIME format.
> --------------FBEC8008D2C49F913E33A8F2
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> Achim,
>
> If you create a file without specifying the name, Ada is
supposed to create
> a temporary
> file which is "automagically" deleted on close. You shouldn't
need the
> Delete call.
>
> Hope this helps.
> John

No, that does not help at all, his problem has nothing at all
to do with whether or not the file gets deleted!


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Create-Delete tmp Files
  2000-03-18  0:00   ` Robert Dewar
@ 2000-03-20  0:00     ` Achim Gerhard
  2000-03-20  0:00       ` Gautier
                         ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Achim Gerhard @ 2000-03-20  0:00 UTC (permalink / raw)


In article <8b0pla$aub$1@nnrp1.deja.com>,
Robert Dewar <robert_dewar@my-deja.com> wrote:
> In article <38D27008.4055C0AB@res.raytheon.com>,
> John J Cupak Jr <John_J_Cupak@res.raytheon.com> wrote:
> >
> > Achim,
> >
> > If you create a file without specifying the name, Ada is
> supposed to create
> > a temporary
> > file which is "automagically" deleted on close. You shouldn't
> need the
> > Delete call.
> >
> > Hope this helps.
> > John
>
> No, that does not help at all, his problem has nothing at all
> to do with whether or not the file gets deleted!
John , Robert,
My intention is to create a 'temporary' file, write something into that
file, then read from that file, and finally delete the 'temporary'
file.
And I want to do that periodically - 24h a day, 7 days a week ...
The question is:
is these legal Ada code?
loop
Text_IO.Create ( File => the_file, Mode => Text_IO.OUT_File );
Text_IO.Reset ( File => the_file, Mode => Text_IO.IN_File );
Text_IO.Delete ( File => the_file );
end loop;
And the question behind that is:
Why does this code cause the Ada runtime to accumulate memory?
For me, at this time, it doesn't matter what compiler and machine.
The question is not:
What are the alternatives/better solutions to do this. ;-)
Regards,
Achim
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
--
_ _
/A/G
--
_ _
/A/G


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Create-Delete tmp Files
  2000-03-20  0:00     ` Achim Gerhard
@ 2000-03-20  0:00       ` Gautier
  2000-03-20  0:00         ` Preben Randhol
  2000-03-20  0:00       ` tmoran
  2000-03-20  0:00       ` Robert A Duff
  2 siblings, 1 reply; 21+ messages in thread
From: Gautier @ 2000-03-20  0:00 UTC (permalink / raw)


> What are the alternatives/better solutions to do this. ;-)

Maybe you need a more permanent file. A way is to try creating
files like "tempfile.100". If there must be several, you check
for existence of "tempfile.100", "tempfile.101", etc. until
there is a name free.

_____________________________________________
Gautier  --  http://members.xoom.com/gdemont/




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Create-Delete tmp Files
  2000-03-20  0:00         ` Preben Randhol
@ 2000-03-20  0:00           ` Gautier
  2000-03-20  0:00             ` Preben Randhol
  0 siblings, 1 reply; 21+ messages in thread
From: Gautier @ 2000-03-20  0:00 UTC (permalink / raw)


> >Maybe you need a more permanent file. A way is to try creating
> >files like "tempfile.100". If there must be several, you check
> >for existence of "tempfile.100", "tempfile.101", etc. until
> >there is a name free.

Preben Randhol wrote:

> How would you do this codewise?

You make a loop with i in 100 .. 999 and check existence of
"tempfile." & integer'image(i). If the file doesn't exist, you
decide it is the good one: you return the name. Of course one has
to be careful if there are parallel tasks doing the same, to lock
the free name as soon as possible maybe by creating an bogus file with
that name or a more solid method with an array of boolean of the range
(say Name_locked:= (others=> false)).
If the loop exists normally, you raise an exception such as
no_name_available_for_temp_file...

This is coded +/- so in the AD trace-back interface for GNAT
( source ad.adb in zip file http://members.xoom.com/gdemont/logiciel/ad.zip
  or in AdaGIDE,
  web page http://members.xoom.com/gdemont/ad.htm )

_____________________________________________
Gautier  --  http://members.xoom.com/gdemont/




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Create-Delete tmp Files
  2000-03-20  0:00     ` Achim Gerhard
  2000-03-20  0:00       ` Gautier
  2000-03-20  0:00       ` tmoran
@ 2000-03-20  0:00       ` Robert A Duff
  2000-03-20  0:00         ` Achim Gerhard
  2 siblings, 1 reply; 21+ messages in thread
From: Robert A Duff @ 2000-03-20  0:00 UTC (permalink / raw)


Achim Gerhard <achim_g@my-deja.com> writes:

> The question is:
> is these legal Ada code?

By the way, "legal" is a compile-time thing in Ada, which isn't what you
mean here.

> loop
> Text_IO.Create ( File => the_file, Mode => Text_IO.OUT_File );
> Text_IO.Reset ( File => the_file, Mode => Text_IO.IN_File );
> Text_IO.Delete ( File => the_file );
> end loop;
> And the question behind that is:
> Why does this code cause the Ada runtime to accumulate memory?

Because you didn't Close the file.

- Bob




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Create-Delete tmp Files
  2000-03-20  0:00       ` Robert A Duff
@ 2000-03-20  0:00         ` Achim Gerhard
  2000-03-20  0:00           ` Robert A Duff
  0 siblings, 1 reply; 21+ messages in thread
From: Achim Gerhard @ 2000-03-20  0:00 UTC (permalink / raw)


In article <wcczortzqw8.fsf@world.std.com>,
Robert A Duff <bobduff@world.std.com> wrote:
> Achim Gerhard <achim_g@my-deja.com> writes:
>
> > The question is:
> > is these legal Ada code?
>
> By the way, "legal" is a compile-time thing in Ada, which isn't what
you
> mean here.
Excuse my bad English. What would you say?
>
> > loop
> > Text_IO.Create ( File => the_file, Mode => Text_IO.OUT_File );
> > Text_IO.Reset ( File => the_file, Mode => Text_IO.IN_File );
> > Text_IO.Delete ( File => the_file );
> > end loop;
> > And the question behind that is:
> > Why does this code cause the Ada runtime to accumulate memory?
>
> Because you didn't Close the file.
From LRM, A.8.2 File Management
12 procedure Delete(File : in out File_Type);
13 Deletes the external file associated with the given file.
The given file is closed, and the external file ceases to exist.
^^^^^^^^^
14 The exception Status_Error is propagated if the given file is
not open. The exception Use_Error is propagated if deletion of
the external file is not supported by the external environment.
BTW: I still use Ada83 but that's almost the same in this case
Regards
Achim
>
> - Bob
>
--
_ _
/A/G


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Create-Delete tmp Files
  2000-03-20  0:00         ` Achim Gerhard
@ 2000-03-20  0:00           ` Robert A Duff
  0 siblings, 0 replies; 21+ messages in thread
From: Robert A Duff @ 2000-03-20  0:00 UTC (permalink / raw)


Achim Gerhard <achim_g@my-deja.com> writes:

> > By the way, "legal" is a compile-time thing in Ada, which isn't what
> you
> > mean here.
> Excuse my bad English. 

It's not bad English.  It's just bad Ada jargon.  ;-)  "Legal" and
"illegal" are defined in chap 1 of the Ada RM.

>...What would you say?

How about, "Should the following work?"

> > > loop
> > > Text_IO.Create ( File => the_file, Mode => Text_IO.OUT_File );
> > > Text_IO.Reset ( File => the_file, Mode => Text_IO.IN_File );
> > > Text_IO.Delete ( File => the_file );
> > > end loop;
> > > And the question behind that is:
> > > Why does this code cause the Ada runtime to accumulate memory?
> >
> > Because you didn't Close the file.
> From LRM, A.8.2 File Management
> 12 procedure Delete(File : in out File_Type);
> 13 Deletes the external file associated with the given file.
> The given file is closed, and the external file ceases to exist.
> ^^^^^^^^^

OK, I guess I was wrong.  I don't know why it leaks memory.

- Bob




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Create-Delete tmp Files
  2000-03-20  0:00     ` Achim Gerhard
  2000-03-20  0:00       ` Gautier
@ 2000-03-20  0:00       ` tmoran
  2000-03-21  0:00         ` Achim Gerhard
  2000-03-20  0:00       ` Robert A Duff
  2 siblings, 1 reply; 21+ messages in thread
From: tmoran @ 2000-03-20  0:00 UTC (permalink / raw)


>loop
>Text_IO.Create ( File => the_file, Mode => Text_IO.OUT_File );
>Text_IO.Reset ( File => the_file, Mode => Text_IO.IN_File );
>Text_IO.Delete ( File => the_file );
>end loop;
>Why does this code cause the Ada runtime to accumulate memory?
>For me, at this time, it doesn't matter what compiler and machine.
  For me, using Janus 3.1.1e for Windows NT and using the vendor's
library Memavail and Maxavail routines, and the Windows 95 System
Monitor accessory, 10,000 times around the loop shows no memory loss.
Sounds like an error in your compilers or OSes.




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Create-Delete tmp Files
  2000-03-20  0:00       ` Gautier
@ 2000-03-20  0:00         ` Preben Randhol
  2000-03-20  0:00           ` Gautier
  0 siblings, 1 reply; 21+ messages in thread
From: Preben Randhol @ 2000-03-20  0:00 UTC (permalink / raw)


On Mon, 20 Mar 2000 10:55:12 +0000, Gautier wrote:

>Maybe you need a more permanent file. A way is to try creating
>files like "tempfile.100". If there must be several, you check
>for existence of "tempfile.100", "tempfile.101", etc. until
>there is a name free.

How would you do this codewise? 

-- 
Preben Randhol -- [randhol@pvv.org] -- <http://www.pvv.org/~randhol/>
         "Det eneste trygge stedet i verden er inne i en fortelling."
                                                      -- Athol Fugard




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Create-Delete tmp Files
  2000-03-20  0:00           ` Gautier
@ 2000-03-20  0:00             ` Preben Randhol
  0 siblings, 0 replies; 21+ messages in thread
From: Preben Randhol @ 2000-03-20  0:00 UTC (permalink / raw)


On Mon, 20 Mar 2000 14:39:12 +0000, Gautier wrote:
[...]
>decide it is the good one: you return the name. Of course one has
>to be careful if there are parallel tasks doing the same, to lock
>the free name as soon as possible maybe by creating an bogus file with
>that name or a more solid method with an array of boolean of the range
>(say Name_locked:= (others=> false)).

Given you are not on a unix OS I guess. 

>If the loop exists normally, you raise an exception such as
>no_name_available_for_temp_file...

I was thinking about what can one use to check if a file exists? 

It looks like AD.ADB uses Exist, but which package provides this?

-- 
Preben Randhol -- [randhol@pvv.org] -- <http://www.pvv.org/~randhol/>
         "Det eneste trygge stedet i verden er inne i en fortelling."
                                                      -- Athol Fugard




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Create-Delete tmp Files
  2000-03-20  0:00       ` tmoran
@ 2000-03-21  0:00         ` Achim Gerhard
  2000-03-21  0:00           ` Roger Barnett
  2000-03-21  0:00           ` Robert Dewar
  0 siblings, 2 replies; 21+ messages in thread
From: Achim Gerhard @ 2000-03-21  0:00 UTC (permalink / raw)


In article <tqtB4.3191$b64.79684@news.pacbell.net>,
tmoran@bix.com wrote:
> >loop
> >Text_IO.Create ( File => the_file, Mode => Text_IO.OUT_File );
> >Text_IO.Reset ( File => the_file, Mode => Text_IO.IN_File );
> >Text_IO.Delete ( File => the_file );
> >end loop;
> >Why does this code cause the Ada runtime to accumulate memory?
> >For me, at this time, it doesn't matter what compiler and machine.
> For me, using Janus 3.1.1e for Windows NT and using the vendor's
> library Memavail and Maxavail routines, and the Windows 95 System
> Monitor accessory, 10,000 times around the loop shows no memory loss.
> Sounds like an error in your compilers or OSes.
OK.
But it seems to be a common error. You can see this behaviour with
Alsys Ada v5.5.2 and v6.2.1; Solaris 2.5; Sparc
VADSself Ada 6.2; Solaris 2.5; Sparc
Alsys Ada V5.5.8; LynxOS 2.3; x86
ObjectAda 7.1.2; MS-Windows NT; x86
GNAT 3.12p; MS-Windows NT; x86
(all for now)
I wrote 'it doesn't matter what compiler and machine', because my
question was (in 'other' words):
"Should the following work?"
loop
Text_IO.Create ( File => the_file, Mode => Text_IO.OUT_File );
... some statements to write to the_file
...
Text_IO.Reset ( File => the_file, Mode => Text_IO.IN_File );
... some statements to read from the_file
...
Text_IO.Delete ( File => the_file );
-- at this point all stuff concerning the_file has disappeared
-- and the heap (and everything else) looks as if the_file
-- has never been created
end loop;
Something is wrong. Is it my Ada code or is it the Ada runtime?
Regards,
Achim
--
_ _
/A/G


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Create-Delete tmp Files
  2000-03-21  0:00         ` Achim Gerhard
  2000-03-21  0:00           ` Roger Barnett
@ 2000-03-21  0:00           ` Robert Dewar
  1 sibling, 0 replies; 21+ messages in thread
From: Robert Dewar @ 2000-03-21  0:00 UTC (permalink / raw)


In article <8b8195$ahk$1@nnrp1.deja.com>,
  Achim Gerhard <achim_g@my-deja.com> wrote:
> Something is wrong. Is it my Ada code or is it the Ada
runtime?
> Regards,
> Achim


Impossible to say, most likely your Ada code (unlikely that
so many different Ada runtimes are wrong), but since you
did not give your code, only a sketch from which no conclusions
can be drawn, no one can answer the above question.

I would suggest that you deal with your vendor's support
services to track this problem down.


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Create-Delete tmp Files
  2000-03-21  0:00         ` Achim Gerhard
@ 2000-03-21  0:00           ` Roger Barnett
  2000-03-23  0:00             ` Achim Gerhard
  2000-03-21  0:00           ` Robert Dewar
  1 sibling, 1 reply; 21+ messages in thread
From: Roger Barnett @ 2000-03-21  0:00 UTC (permalink / raw)



Where and how is "the_file" declared ?

-- 
Roger Barnett






^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Create-Delete tmp Files
  2000-03-21  0:00           ` Roger Barnett
@ 2000-03-23  0:00             ` Achim Gerhard
  2000-03-23  0:00               ` Robert Dewar
  2000-03-23  0:00               ` tmoran
  0 siblings, 2 replies; 21+ messages in thread
From: Achim Gerhard @ 2000-03-23  0:00 UTC (permalink / raw)


In article <649110192wnr@natron.demon.co.uk>,
Roger@natron.demon.co.uk wrote:
>
> Where and how is "the_file" declared ?
>
Roger,
this is the whole Ada code (the main program)
with Text_IO;
procedure IO_Test
is
the_file : Text_IO.File_Type;
begin
for i in integer range 1 .. 100_000 loop
Text_IO.Create ( File => the_file, Mode => Text_IO.OUT_File );
Text_IO.Reset ( File => the_file, Mode => Text_IO.IN_File );
Text_IO.Delete ( File => the_file );
end loop;
end IO_Test;
Regards,
Achim
> --
> Roger Barnett
>
>
--
_ _
/A/G


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Create-Delete tmp Files
  2000-03-23  0:00             ` Achim Gerhard
@ 2000-03-23  0:00               ` Robert Dewar
  2000-03-24  0:00                 ` Achim Gerhard
  2000-03-23  0:00               ` tmoran
  1 sibling, 1 reply; 21+ messages in thread
From: Robert Dewar @ 2000-03-23  0:00 UTC (permalink / raw)


In article <8bcmds$6e9$1@nnrp1.deja.com>,
  Achim Gerhard <achim_g@my-deja.com> wrote:

> with Text_IO;
> procedure IO_Test
> is
> the_file : Text_IO.File_Type;
> begin
> for i in integer range 1 .. 100_000 loop
> Text_IO.Create ( File => the_file, Mode => Text_IO.OUT_File );
> Text_IO.Reset ( File => the_file, Mode => Text_IO.IN_File );
> Text_IO.Delete ( File => the_file );
> end loop;
> end IO_Test;
> Regards,
> Achim

Actually it does not surprise me one bit that this leaks. When
you use temporary files, they have the semantics that they are
automatically deleted at the end of the run. It is quite
expected that the runtime (either at the Ada level and/or
the OS level) will maintain some data structures for ensuring
that this deletion takes place.

It is rather odd style to explicitly delete such files, so it
is not surprising that the data structures are not cleaned up
to take account of this.



Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Create-Delete tmp Files
  2000-03-23  0:00             ` Achim Gerhard
  2000-03-23  0:00               ` Robert Dewar
@ 2000-03-23  0:00               ` tmoran
  1 sibling, 0 replies; 21+ messages in thread
From: tmoran @ 2000-03-23  0:00 UTC (permalink / raw)


> with Text_IO;
> procedure IO_Test
> is
> the_file : Text_IO.File_Type;
> begin
> for i in integer range 1 .. 100_000 loop
> Text_IO.Create ( File => the_file, Mode => Text_IO.OUT_File );
> Text_IO.Reset ( File => the_file, Mode => Text_IO.IN_File );
> Text_IO.Delete ( File => the_file );
> end loop;
> end IO_Test;
Run on Windows 95 on a RAM disk with the System Monitor Accessory
showing Allocated Memory:
Gnat 3.12p  Allocated memory ramps up, then starts ramping up
  more slowly.  Hard disk activity starts, presumably due to paging.
Janus 3.1.1.e  Allocated memory stays flat during entire run.
ObjectAda 7.1.2  Allocated memory stays flat during entire run.




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Create-Delete tmp Files
  2000-03-23  0:00               ` Robert Dewar
@ 2000-03-24  0:00                 ` Achim Gerhard
  2000-03-24  0:00                   ` Robert Dewar
  0 siblings, 1 reply; 21+ messages in thread
From: Achim Gerhard @ 2000-03-24  0:00 UTC (permalink / raw)


In article <8bdcb6$tmo$1@nnrp1.deja.com>,
Robert Dewar <robert_dewar@my-deja.com> wrote:
> In article <8bcmds$6e9$1@nnrp1.deja.com>,
> Achim Gerhard <achim_g@my-deja.com> wrote:
>
> > with Text_IO;
> > procedure IO_Test
> > is
> > the_file : Text_IO.File_Type;
> > begin
> > for i in integer range 1 .. 100_000 loop
> > Text_IO.Create ( File => the_file, Mode => Text_IO.OUT_File );
> > Text_IO.Reset ( File => the_file, Mode => Text_IO.IN_File );
> > Text_IO.Delete ( File => the_file );
> > end loop;
> > end IO_Test;
> > Regards,
> > Achim
>
> Actually it does not surprise me one bit that this leaks. When
> you use temporary files, they have the semantics that they are
> automatically deleted at the end of the run. It is quite
> expected that the runtime (either at the Ada level and/or
> the OS level) will maintain some data structures for ensuring
> that this deletion takes place.
>
> It is rather odd style to explicitly delete such files, so it
> is not surprising that the data structures are not cleaned up
> to take account of this.
I do not agree. If the implementation does not support deletion in this
case, I would expect, that a call to DELETE will raise the exception
USE_ERROR.
Also, a explicit call of DELETE does not contradict with the clean up
during the completion of the main program.
Regards,
Achim
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
--
_ _
/A/G
--
_ _
/A/G


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Create-Delete tmp Files
  2000-03-24  0:00                 ` Achim Gerhard
@ 2000-03-24  0:00                   ` Robert Dewar
  0 siblings, 0 replies; 21+ messages in thread
From: Robert Dewar @ 2000-03-24  0:00 UTC (permalink / raw)


In article <8bfd8b$6g6$1@nnrp1.deja.com>,
  Achim Gerhard <achim_g@my-deja.com> wrote:
> I do not agree. If the implementation does not support
> deletion in this case,

Of course deletion is supported, that is not the issue, so you
are disagreeing with a position that no one has taken, and a
behavior that no one has described!

> Also, a explicit call of DELETE does not contradict with the
> clean up during the completion of the main program.

Everyone agrees with this, and no one has reported any
behavior to the contrary.


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2000-03-24  0:00 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-17  0:00 Create-Delete tmp Files Achim Gerhard
2000-03-17  0:00 ` Robert Dewar
2000-03-17  0:00 ` John J Cupak Jr
2000-03-18  0:00   ` Robert Dewar
2000-03-20  0:00     ` Achim Gerhard
2000-03-20  0:00       ` Gautier
2000-03-20  0:00         ` Preben Randhol
2000-03-20  0:00           ` Gautier
2000-03-20  0:00             ` Preben Randhol
2000-03-20  0:00       ` tmoran
2000-03-21  0:00         ` Achim Gerhard
2000-03-21  0:00           ` Roger Barnett
2000-03-23  0:00             ` Achim Gerhard
2000-03-23  0:00               ` Robert Dewar
2000-03-24  0:00                 ` Achim Gerhard
2000-03-24  0:00                   ` Robert Dewar
2000-03-23  0:00               ` tmoran
2000-03-21  0:00           ` Robert Dewar
2000-03-20  0:00       ` Robert A Duff
2000-03-20  0:00         ` Achim Gerhard
2000-03-20  0:00           ` Robert A Duff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox