Re: [9fans] memory bug in 5l

2014-12-09 Thread Steve Simon
the compilers use a very simple allocator which is designed for speed rather than efficiency - as i remember it never frees anything and just allocates from a heap. it also works if you use libc's malloc and that will allow you to link big things (like gs) on small memory machines. in reality mem

Re: [9fans] memory bug in 5l

2014-12-09 Thread yoann padioleau
There is a related bug still in this file in ldobj() I think: if(nhunk < sizeof(Prog)) gethunk(); p = (Prog*)hunk; nhunk -= sizeof(Prog); hunk += sizeof(Prog); it should be while(chunk < sizeof(Prog)) (or even better again, a simple call to malloc(s

Re: [9fans] memory bug in 5l

2014-12-09 Thread yoann padioleau
Also, by curiosity, does anybody know why 5a/, 5l/, 5c/ (and the other architecture variants) are redefining malloc and free? Why not using the malloc and free from the libc? On Dec 9, 2014, at 4:21 PM, yoann padioleau wrote: > in 5l/obj.c#zaddr() > there is: > case D_FCONST: >

[9fans] memory bug in 5l

2014-12-09 Thread yoann padioleau
in 5l/obj.c#zaddr() there is: case D_FCONST: while(nhunk < sizeof(Ieee)) gethunk(); a->ieee = (Ieee*)hunk; nhunk -= NSNAME; hunk += NSNAME; I think it’s a copy paste bug, it should be sizeof(Ieee) inste