[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: variables in yyparse

From: Laurence Finston
Subject: Re: variables in yyparse
Date: Sun, 19 Dec 2004 00:58:59 +0100
User-agent: IMHO/0.98.3+G (Webmail for Roxen)

From: Hans Aberg <address@hidden> 

> I still do not see why you have to throw exceptions without the functions.
> If you do not have a good memory recover, a bad_alloc usually means that the
> whole program is toast. So recovery need to be somewhere where both memory
> can be reclaimed and the failed code can be rerun.

Allocation is performed in some actions, not just in functions called from
actions.  If I catch `bad_alloc' and rethrow it, I can trace the path of the
throws without using a debugger. 

I've explained that `Scanner_Nodes' represent the state of a parse in
a thread on `help-bison'.  Since 3D graphics potentially uses a lot of memory,
and since input can be performed concurrently in multiple threads, it's
conceivable that I could run out of memory.  In that case, my plan is to dump
the information in the `Scanner_Node' to a file, free the memory for the
objects on it, and put that thread to sleep until another thread finishes. 
Then I'll wake up the first thread, read in the dumped file, and continue

I plan to write a second parser for reading binary files in a machine-like
language for fast-loading format files.  I plan to create these files in
precisely the same way, i.e., dumping `Scanner_Nodes', so I can use them for
recovering from `bad_alloc' exceptions, too.  


reply via email to

[Prev in Thread] Current Thread [Next in Thread]