Re: Bug fix in motoi_assign
David Hakim <dhakim-Gkm/TONP9n1Wk0Htik3J/[email protected]> Sun, 3 Aug 2003 14:52:26 -0400
| Newsgroups | gmane.comp.lang.moto.devel |
|---|---|
| Message-ID | <[email protected]> |
Funny ... this will teach me to read all my emails first and not try to
respond one at a time. The patch I applied (and committed) to the main
branch already was basically this portion of yours:
@@ -766,21 +766,24 @@
env->rval_uc = NULL;
}
- /* FIXME!!! nasty but nice */
-
- if( lval->opcell.opcode == DEREFERENCE_LVAL )
- motoi_dereference_rval(uc_operand(p, 0));
- else
- motoi(uc_operand(p, 0));
-
- v1 = opstack_pop(env);
v2 = opstack_pop(env);
+ if ((lval->type == OP_TYPE &&
+ lval->opcell.opcode == ARRAY_LVAL) ||
+ (lval->type == OP_TYPE
+ && lval->opcell.opcode == DEREFERENCE_LVAL)) {
+ v1 = moto_getVarVal(env,dest);
+ } else {
+ motoi(lval);
+ v1 = opstack_pop(env);
+ }
+
if(motox_try_overloaded_method_op(op,v1,v2,NULL) != MOTO_OK) {
motoi_domath(v1, v2, op);
moto_freeVal(env,v1);
moto_freeVal(env,v2);
}
+
break;
}
I'm still investigating the rest of the patch ... I am a little
hesitant to add another memory tracking hashtable to env but once I
understand the implications of that part of your fix I'll post again.
-Dave
On Saturday, August 2, 2003, at 09:44 PM, Stefano Corsi wrote:
> Hi Dave,
>
> the same patch as before, but now with one more bug corrected, in
> motoi_assign. Now I can run ary3.moto, from perftest.tar.gz, and in 7
> minutes
> I get the result! Now the big problem is memory from constructors.
> Look at
> this, for example:
>
> ${
> use "codex.util";
> int i=0;
> int j=0;
> for (i = 0; i < 100; i++) {
> Vector v = new Vector();
> v.add("a");
> v.add("b");
> v.add("c");
> v.add("d");
> v.add("e");
> v.add("f");
> v.add("g");
> for (j = 0; j < 1000; j++) {
> Integer foo = new Integer(j); <---- This
> }
> }
> }$
>
> memory from the new operations never gets released...
>
> Ciao,
> Stefano
> <motomem.patch>