On Mon, May 24, 2010 at 8:56 AM, Mark Phalan <mark.pha...@sun.com> wrote: > On Mon, 2010-05-24 at 13:42 +0200, Mark Phalan wrote: >> On Tue, 2010-05-18 at 17:28 -0400, Angelo Rajadurai wrote: >> > >> > The way to fix it is to set strsize >> > >> > #pragma D option strsize=1024 // make sure your string can fit in! >> > >> >> Thanks for the idea but it doesn't seem to make any difference even if I >> increase strsize up to 2097152 (above which I get drops). >> The size of the string is just 5 characters "TEST" + "@". >> >> I'll file a bug. > > > 6955097 "out of scratch space in action" error with small amounts of > data >
I don't think this is a bug in DTrace, I think this is just an off-by-one error in your original code. Try adding 1 to data.length. Even though "string" is a separate type in DTrace, a string is still just stored as a null-terminated sequence of characters. stringof() isn't doing anything to null-terminate what you give it, it's just assuming that you're giving it something that's null-terminated. In this case, it appears that there's enough garbage after the copied-in string to ... Oh. I know what's happening. Because there's no null-termination on the string, strjoin() actually ends up generating the garbage that makes the copied-in string appear infinitely long. +---+---+---+---+---+---+---+---+---+---+---+---+---+---+ | T | E | S | T | @ | T | E | S | T | @ | T | E | S | T | ... +---+---+---+---+---+---+---+---+---+---+---+---+---+---+ ^ ^ | | A B strjoin() is copying from pointer A to pointer B. Pointer A never hits a '\0', you just end up running out of scratch space. Chad _______________________________________________ dtrace-discuss mailing list dtrace-discuss@opensolaris.org