pthread_create() munging malloc()ed memory? (malloc(), threads, and static linking) [RPI-B+, 10.1]

Trevor Roydhouse trev at sentry.org
Wed Mar 18 09:25:41 UTC 2015


Molly (Dev Lists) wrote:
> After a few iterations of this (in a loop in main()), those "non-zero"
> bytes become zeroed out during the call to pthread_create().  This only
> occurs a couple of times, and then the behavior seems to return to
> normal for subsequent calls.
[...]
> This is running on a Raspberry Pi B+ using the 10.1-RELEASE image
> (FreeBSD 10.1-RELEASE #0 r274401).  clang is version 3.4.1 (the
> version included in the base system).

RPi B+

FreeBSD rpi 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r278908: Tue Feb 17 
23:25:47 UTC 2015

FreeBSD clang version 3.5.1 (tags/RELEASE_351/final 225668) 20150115
Target: armv6--freebsd11.0-gnueabi
Thread model: posix

trev at rpi [/home/trev] $ ./a.out
Value in thread: 12345
Value in thread: 12345
Value in thread: 12345
Value in thread: 12345
Value in thread: 12345
Value in thread: 12345
Value in thread: 12345
Value in thread: 12345
Value in thread: 12345
Value in thread: 12345

Built as per:

// Build with:  cc -std=c11 -Weverything -pthread -static thisfile.c

-- 
Trevor Roydhouse
BJuris, LLB, LLM (UNSW)
Systems Developer
Australasian Legal Information Institute    Web  : www.austlii.edu.au


More information about the freebsd-arm mailing list