* Gnat.Sockets.Stream memory "leak"
@ 2003-07-01 19:04 Jano
2003-07-02 9:50 `
0 siblings, 1 reply; 6+ messages in thread
From: Jano @ 2003-07-01 19:04 UTC (permalink / raw)
Okay, here I go.
I've spent today quite a time tracking down a memory leak. It has
finally resulted it was exactly not a leak, only a misassumption on my
part.
It happens that each call to Gnat.Sockets.Stream allocates a new stream
object to return its access.
My assumption was that, like the Ada.Streams.Stream_IO.Stream call, that
Stream_access need not to be freed. Now, I see not any recommendation or
note about the necessity of freeing these resources neither in Stream_IO
nor in Gnat.Sockets. I'm mistaken about Stream_IO not needing the free?
I've been naive about Gnat.Sockets silence about it?
And, as a side note, why doesn't exist a Stream_access type in
Ada.Streams? I find somewhat inconvenient defining it in my packages and
converting here and there.
Thanks!
--
-------------------------
Jano
402450.at.cepsz.unizar.es
-------------------------
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Gnat.Sockets.Stream memory "leak"
2003-07-01 19:04 Gnat.Sockets.Stream memory "leak" Jano
@ 2003-07-02 9:50 `
2003-07-02 20:51 ` Jano
0 siblings, 1 reply; 6+ messages in thread
From: @ 2003-07-02 9:50 UTC (permalink / raw)
Jano wrote:
> And, as a side note, why doesn't exist a Stream_access type in
> Ada.Streams? I find somewhat inconvenient defining it in my packages and
> converting here and there.
My opinion is that they left this for each concrete implementation of
streams. For instance, Ada.Streams.Streams_IO has the Stream_Access type
and GNAT.Sockets has it as well. You do not have to define it in your
own packages.
Rodrigo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Gnat.Sockets.Stream memory "leak"
2003-07-02 9:50 `
@ 2003-07-02 20:51 ` Jano
2003-07-04 10:23 `
0 siblings, 1 reply; 6+ messages in thread
From: Jano @ 2003-07-02 20:51 UTC (permalink / raw)
=?UTF-8?B?Um9kcmlnbyBHYXJjw61h?= <rodrigo.garcia.ARROBA.epfl.ch> dice...
> Jano wrote:
>
> > And, as a side note, why doesn't exist a Stream_access type in
> > Ada.Streams? I find somewhat inconvenient defining it in my packages and
> > converting here and there.
>
> My opinion is that they left this for each concrete implementation of
> streams. For instance, Ada.Streams.Streams_IO has the Stream_Access type
> and GNAT.Sockets has it as well. You do not have to define it in your
> own packages.
That's okay, I'm thinking more about when I need to store an access
somewhere (not merely pass it as an access parameter), being it
completely irrelevant what is the precise accessed stream. Then I need
to roll out my own stream_access to Root'Class.
--
-------------------------
Jano
402450.at.cepsz.unizar.es
-------------------------
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Gnat.Sockets.Stream memory "leak"
2003-07-02 20:51 ` Jano
@ 2003-07-04 10:23 `
2003-07-04 14:04 ` Jano
0 siblings, 1 reply; 6+ messages in thread
From: @ 2003-07-04 10:23 UTC (permalink / raw)
Jano wrote:
> =?UTF-8?B?Um9kcmlnbyBHYXJjw61h?= <rodrigo.garcia.ARROBA.epfl.ch> dice...
>
>>Jano wrote:
>>
>>
>>>And, as a side note, why doesn't exist a Stream_access type in
>>>Ada.Streams? I find somewhat inconvenient defining it in my packages and
>>>converting here and there.
>>
>>My opinion is that they left this for each concrete implementation of
>>streams. For instance, Ada.Streams.Streams_IO has the Stream_Access type
>>and GNAT.Sockets has it as well. You do not have to define it in your
>>own packages.
>
>
> That's okay, I'm thinking more about when I need to store an access
> somewhere (not merely pass it as an access parameter), being it
> completely irrelevant what is the precise accessed stream. Then I need
> to roll out my own stream_access to Root'Class.
>
I do not understand you here... Why do you want to store an access to a
stream? And where (in memory or in disk)? To store it in memory you only
have to create a variable of the Stream_Access type...
Can you give an example of what you mean?
Rodrigo
PS: I would not worry about having to free the memory taken for the
stream access as long as you close the socket.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Gnat.Sockets.Stream memory "leak"
2003-07-04 10:23 `
@ 2003-07-04 14:04 ` Jano
2003-07-07 8:39 `
0 siblings, 1 reply; 6+ messages in thread
From: Jano @ 2003-07-04 14:04 UTC (permalink / raw)
=?UTF-8?B?Um9kcmlnbyBHYXJjw61h?= <rodrigo.garcia.ARROBA.epfl.ch> dice...
> I do not understand you here... Why do you want to store an access to a
> stream? And where (in memory or in disk)? To store it in memory you only
> have to create a variable of the Stream_Access type...
In memory, of course. I have some objects that operate over streams. I
pass the stream in an access parameter, but to store it I don't care
(nor know) if they are Stream_io.Stream_access or Sockets.Stream_access,
etc so I can't use any of the preexistent Stream_access types. I need to
define my own access to Root_stream_type'Class. I simply would find
convenient that these root'Class access where defined where it all
starts: in Ada.Streams. Since I must "with" that package to have access
parameters to streams, it would spare me the definition.
I hope it's clearer now.
--
-------------------------
Jano
402450.at.cepsz.unizar.es
-------------------------
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Gnat.Sockets.Stream memory "leak"
2003-07-04 14:04 ` Jano
@ 2003-07-07 8:39 `
0 siblings, 0 replies; 6+ messages in thread
From: @ 2003-07-07 8:39 UTC (permalink / raw)
Jano wrote:
> =?UTF-8?B?Um9kcmlnbyBHYXJjw61h?= <rodrigo.garcia.ARROBA.epfl.ch> dice...
>
>>I do not understand you here... Why do you want to store an access to a
>>stream? And where (in memory or in disk)? To store it in memory you only
>>have to create a variable of the Stream_Access type...
>
>
> In memory, of course. I have some objects that operate over streams. I
> pass the stream in an access parameter, but to store it I don't care
> (nor know) if they are Stream_io.Stream_access or Sockets.Stream_access,
> etc so I can't use any of the preexistent Stream_access types. I need to
> define my own access to Root_stream_type'Class. I simply would find
> convenient that these root'Class access where defined where it all
> starts: in Ada.Streams. Since I must "with" that package to have access
> parameters to streams, it would spare me the definition.
>
> I hope it's clearer now.
Yes, I fully understand your problem now and, frankly, I do not really
know why they did not define an access to streams type in Ada.Streams.
Anyway, you can still use the one defined in Stream_IO, as it is an
access to the Root_Stream_Type'Class (you can also assign "socket
streams" or any other kind of stream to it).
Rodrigo
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2003-07-07 8:39 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-01 19:04 Gnat.Sockets.Stream memory "leak" Jano
2003-07-02 9:50 `
2003-07-02 20:51 ` Jano
2003-07-04 10:23 `
2003-07-04 14:04 ` Jano
2003-07-07 8:39 `
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox