On 03/12/2013, at 7:42 AM, srean wrote:

> Will some automatic leak checker like valgrind, memprof help, when you try it 
> on the webserver while loading a page that triggers the leak. The page on 
> hunting leaks in Nde was quite instructive. Valgrind 

( DYLD_LIBRARY_PATH=build/release/host/lib/rtl valgrind --dsymutil=yes 
build/release/host/bin/flx --test=b
uild/release src/tools/webserver --port=1235 2>&1)

^CShell terminated by signal SIGINT
==1894==
==1894== HEAP SUMMARY:
==1894==     in use at exit: 3,753,611 bytes in 57,310 blocks
==1894==   total heap usage: 246,835 allocs, 189,525 frees, 19,623,040 bytes 
allocated
==1894==
==1894== LEAK SUMMARY:
==1894==    definitely lost: 775,742 bytes in 17,165 blocks
==1894==    indirectly lost: 2,214,036 bytes in 29,183 blocks
==1894==      possibly lost: 2,365 bytes in 73 blocks
==1894==    still reachable: 761,468 bytes in 10,889 blocks
==1894==         suppressed: 0 bytes in 0 blocks
==1894== Rerun with --leak-check=full to see details of leaked memory
==1894==
==1894== For counts of detected and suppressed errors, rerun with: -v
==1894== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

Not even sure if it's grinding webserver as opposed to flx.

Ok, so running on webserver binary executable ..

==1902== Conditional jump or move depends on uninitialised value(s)
==1902==    at 0x1002195D8: pthread_rwlock_init (in /usr/lib/libSystem.B.dylib)

That's the OSX problem. There's a way to work around it.

==1902==
==1902== HEAP SUMMARY:
==1902==     in use at exit: 205,147 bytes in 3,702 blocks
==1902==   total heap usage: 12,066 allocs, 8,364 frees, 2,487,653 bytes 
allocated
==1902==
==1902== LEAK SUMMARY:
==1902==    definitely lost: 12,360 bytes in 505 blocks
==1902==    indirectly lost: 62,376 bytes in 1,320 blocks
==1902==      possibly lost: 56,600 bytes in 1,140 blocks
==1902==    still reachable: 73,811 bytes in 737 blocks
==1902==         suppressed: 0 bytes in 0 blocks
==1902== Rerun with --leak-check=full to see details of leaked memory
==1902==
==1902== For counts of detected and suppressed errors, rerun with: -v
==1902== Use --track-origins=yes to see where uninitialised values come from
==1902== ERROR SUMMARY: 40 errors from 4 contexts (suppressed: 0 from 0)

Basically it's too much work. Valgrind is just plain wrong in too many
cases.

For example, some of the "errors" it sees are a result of the GC scanning
the stack. It's true some of the scanned addresses are uninitialised.
It's a conservative collector with respect to the stack so this doesn't
matter.

Actually it's tricky on the x86_64 because the idiot API has a thing
called a RED ZONE. That's a block of memory on the wrong side
of the stack pointer that you're ALLOWED to put data in.

Felix doesn't scan that as such. It saves the stack pointer with
a hack, and machine registers in a jmpbuf using setjmp.

Also I cannot stop the webserver properly. Ctrl-C doesn't kill it
under valgrind until I try to load a page. So I'm not sure if FLX_FINALISE
works for it (I think clean up on termination doesn't happen if killed by a 
Ctrl-C).

On the server we now have:
  Memory usage: 32%

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 8006 felixweb  20   0  216m  16m 3136 S  0.0  3.4   0:14.79 webserver

So the 3.4% is where I left it. It's not leaking when no one is using it
at the moment.

Still strings.fdoc is causing this in a few page loads:

 8006 felixweb  20   0  258m  56m 3136 S  0.0 11.5   0:22.70 webserver

So memory use up to 11.5% now.

--
john skaller
skal...@users.sourceforge.net
http://felix-lang.org




------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to