comp.lang.ada
 help / color / mirror / Atom feed
* Stack overflow using Xml/Ada
@ 2004-07-20 21:25 Jano
  2004-07-21  7:37 ` Emmanuel Briot
  0 siblings, 1 reply; 4+ messages in thread
From: Jano @ 2004-07-20 21:25 UTC (permalink / raw)


Hi,

I'm using the excellent Xml/Ada library to parse a file (incidentally, 
created too with Xml/Ada). The problem is when I try to parse it back 
into memory, since I get a stack overflow when calling the

Input_Sources.File.Open

procedure.

I've tracked it a bit and the problem seems to be this declaration in 
input_sources-file.adb/Fast_Read

type Fixed_String is new String (Buf'Range);
package Dir_Fast is new Ada.Direct_IO (Fixed_String);

Where Buf'Range is the file size.

Further inspecting the Direct_IO gnat implementation, it seems that 
inside the instance a buffer it's declared in the stack, of 
Fixed_String'Size:

Zeroes : System.Storage_Elements.Storage_Array := 
   (1 .. System.Storage_Elements.Storage_Offset (Bytes) => 0);
-- Buffer used to fill out partial records.

Since my file is some 3MB in size, and the stack I've allocated is 2MB, 
it fails.

I find too restrictive that the file to parse has to be below stack 
size, so I'm not considering the possibility of increasing stack size as 
a solution (furthermore I've never succeed to get over 2MB stack size in 
linux).

Has anyone faced this problem? If so, how did you solved it?

Thanks in advance,

Alex.

P.s: BTW, is there some mailing list related to this library?



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

* Re: Stack overflow using Xml/Ada
  2004-07-20 21:25 Stack overflow using Xml/Ada Jano
@ 2004-07-21  7:37 ` Emmanuel Briot
  2004-07-21  8:02   ` Jano
  2004-07-21  9:44   ` Georg Bauhaus
  0 siblings, 2 replies; 4+ messages in thread
From: Emmanuel Briot @ 2004-07-21  7:37 UTC (permalink / raw)


On Tue, 20 Jul 2004 23:25:26 +0200, Jano wrote:
> I'm using the excellent Xml/Ada library to parse a file (incidentally, 
> created too with Xml/Ada). The problem is when I try to parse it back 
> into memory, since I get a stack overflow when calling the


This is a known issue with the current public release of XML/Ada,
fixed in customer releases. Using Direct_IO indeed has the limitation
you pointed out. The new version uses Ada.Sequential_IO instead.

You haven't specified on which platform you are, but if you are on
an allocate-on-use system, like linux, you want to unlimited the
stack size anyway, this gives you an immediate workaround
     unlimit stacksize

In passing, I am planning a new public release some time in
september/october, which will including validation capabilities.


Emmanuel



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

* Re: Stack overflow using Xml/Ada
  2004-07-21  7:37 ` Emmanuel Briot
@ 2004-07-21  8:02   ` Jano
  2004-07-21  9:44   ` Georg Bauhaus
  1 sibling, 0 replies; 4+ messages in thread
From: Jano @ 2004-07-21  8:02 UTC (permalink / raw)


Emmanuel Briot wrote:
> On Tue, 20 Jul 2004 23:25:26 +0200, Jano wrote:
> 
>>I'm using the excellent Xml/Ada library to parse a file (incidentally, 
>>created too with Xml/Ada). The problem is when I try to parse it back 
>>into memory, since I get a stack overflow when calling the
> 
> 
> 
> This is a known issue with the current public release of XML/Ada,
> fixed in customer releases. Using Direct_IO indeed has the limitation
> you pointed out. The new version uses Ada.Sequential_IO instead.
> 
> You haven't specified on which platform you are, but if you are on
> an allocate-on-use system, like linux, you want to unlimited the
> stack size anyway, this gives you an immediate workaround
>      unlimit stacksize

I'm using it for a linux/win32 project.

I have in fact unlimited stack in both platforms, but for some reason my 
Pragma Stack_Size aren't honored in linux above 2MB. I tracked it down 
to some issue related with ld, but abandoned without finding a solution. 
I've tried the --Xlinker --stack switches but no success. It hasn't been 
a pressing issue for the moment, so I've leaved it for a later time.

I don't think it will be too difficult to change it myself while waiting 
for the next release? Or if the involved changes are isolated in the 
single file discussed, you already have my email from this morning 
exchange about utf8 (hint hint ;))

Kind regards,

Alex.

> 
> In passing, I am planning a new public release some time in
> september/october, which will including validation capabilities.
> 
> Emmanuel



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

* Re: Stack overflow using Xml/Ada
  2004-07-21  7:37 ` Emmanuel Briot
  2004-07-21  8:02   ` Jano
@ 2004-07-21  9:44   ` Georg Bauhaus
  1 sibling, 0 replies; 4+ messages in thread
From: Georg Bauhaus @ 2004-07-21  9:44 UTC (permalink / raw)


Emmanuel Briot <briot+spam@act-europe.fr> wrote:
 
: In passing, I am planning a new public release some time in
: september/october, which will including validation capabilities.

This is good news!


-- Georg



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

end of thread, other threads:[~2004-07-21  9:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-20 21:25 Stack overflow using Xml/Ada Jano
2004-07-21  7:37 ` Emmanuel Briot
2004-07-21  8:02   ` Jano
2004-07-21  9:44   ` Georg Bauhaus

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