<div dir="ltr"><div dir="ltr">Hi Alistair,</div><br><div class="gmail_quote"><div dir="ltr">On Mon, Dec 17, 2018 at 10:30 PM Alistair Grant <<a href="mailto:akgrant0710@gmail.com">akgrant0710@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"> <br>
Hi Eliot,<br>
<br>
On Sat, Dec 15, 2018 at 04:11:33PM -0800, Eliot Miranda wrote:<br>
>  <br>
> Hi Alistair,<br>
> <br>
> you can do better than using malloc & free in primitiveClosedir et al.<br>
> If you look at the changes I made in VMMaker.oscog-eem.2490<br>
> & VMMaker.oscog-eem.2491 you'll see a simple pattern:<br>
><br>
> ...<br>
><br>
<br>
You are, of course, correct.  By way of excuses: There are a number of<br>
methods that basically do:<br>
<br>
        faPath := calloc(1, sizeof(fapath))<br>
<br>
I was debating with myself between whether to allocate fapath (between <br>
9K and 64K, depending on platform) on the heap or the stack since <br>
there's been some recent discussion about using the VM on SoC systems.  <br></blockquote><div><br></div><div>Oh wow, I had no realization it was that bug.  I had assumed it was the size of a path, i.e. only a few hindered bytes at max.  If it is that big I think the way you're doing things is fine.  I would just ask you to comment the code as being that way because it is that big.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
It's about 30 years since I've dealth with embedded systems (collecting <br>
statistics on X.25 networks) or really thought about stack and heap <br>
allocation - I should have just admitted to myself that I'm so far out <br>
of date that I have no idea. :-)  Anyway, I got caught up on that and <br>
didn't think about this case.<br>
<br>
I'll make the change you suggest, and also move fapath on to the stack <br>
(primitiveOpendir being the exception) - it will be a bit faster for <br>
most people.<br>
<br>
<br>
<br>
> The only thing that;'s unclear for me at the moment is how the result of<br>
> faInvalidateSessionId: gets tested. result doesn't get set by it. I<br>
> presume it sets primitive failure, but there';s no test for primitive<br>
> failure where result is tested (result = 0).<br>
<br>
faInvalidateSessionId can't fail, all it does is set the session Id to 0 <br>
to catch the case where someone tries to reuse an invalid fapath within <br>
a VM session (i.e. after calling primitiveClosedir).<br>
<br>
Cheers,<br>
Alistair<br>
<br>
<br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div></div>