Hello,

I have been working on the memory model for J (the programming
language). J uses a fairly standard memory pool system for small
allocations, with a number of pools which are allocated once needed and
store small values.

My additions are shown here:
https://github.com/iocane/unbox/commit/62a0e6dd0278a49398ec9de06f93896e32a25177
The J source is notoriously hard to read, so this is just intended as a
way to check if I've done anything obviously wrong with Valgrind's
client requests.

When run, valgrind gives a reasonable number of invalid read and write
errors. I haven't been able to verify any of them, so the output might
not be correct. My problem is that they don't give an instance of free
which caused the error like Valgrind does when working with only
malloc/free. The error message only indicates that the address is in one
of the memory pools. Valgrind states that the block is "recently
re-allocated", a term which I don't understand and which doesn't seem to
appear in any of the documentation.

==4888== Invalid write of size 8
==4888==    at 0x4C3117F: memset (in 
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==4888==    by 0x607CE9F: jtexta (m.c:359)
==4888==    by 0x623F2D9: jtpreparse (wc.c:268)
==4888==    by 0x6060F1A: jtcolon (cx.c:295)
==4888==    by 0x60209CB: jtdfs2 (au.c:32)
==4888==    by 0x607F269: jtconj (p.c:62)
==4888==    by 0x607FCFE: jtparsea (p.c:138)
==4888==    by 0x607F986: jtparse (p.c:117)
==4888==    by 0x6083349: jtimmex (px.c:37)
==4888==    by 0x626B120: jtline (xs.c:52)
==4888==    by 0x626B7E4: jtlinf (xs.c:86)
==4888==    by 0x626B8FB: jtscm00 (xs.c:94)
==4888==  Address 0x5c31230 is 4,368 bytes inside a recently re-allocated block 
of size 65,536 alloc'd
==4888==    at 0x4C2ABD0: malloc (in 
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==4888==    by 0x607AF72: jtma (m.c:182)
==4888==    by 0x607C241: jtga (m.c:285)
==4888==    by 0x6071756: jtevinit (i.c:81)
==4888==    by 0x6071E10: jtjinit3 (i.c:154)
==4888==    by 0x6071EAC: jtjinit2 (i.c:169)
==4888==    by 0x60731D3: JInit (io.c:278)
==4888==    by 0x4013DF: jeload (jeload.c:66)
==4888==    by 0x4011BF: main (jconsole.c:133)

What does this error mean? Am I using the memory pool functions
correctly? How do I find when the memory in question was freed, or was
it just never allocated?

Thanks for your help,
Marshall

------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to