Bug 4740 - Valgrind complains about deletion of uninitialized critical sections at startup
Summary: Valgrind complains about deletion of uninitialized critical sections at startup
Status: RESOLVED INVALID
Alias: None
Product: Runtime
Classification: Mono
Component: General ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-04-30 10:51 UTC by Rolf Bjarne Kvinge [MSFT]
Modified: 2014-01-17 18:25 UTC (History)
7 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED INVALID

Description Rolf Bjarne Kvinge [MSFT] 2012-04-30 10:51:48 UTC
Here are a few valgrind errors from a MonoTouch app (running in the simulator):

https://gist.github.com/ffb9dc8ed74a0bf6276b

This seems to happen with any MonoTouch app. I can get line numbers for the stack traces and/or a test case if that's needed.
Comment 1 Zoltan Varga 2012-04-30 11:14:01 UTC
That lock is initialized:
			lock = g_malloc (sizeof(TypeInitializationLock));
			InitializeCriticalSection (&lock->initialization_section);

It could be freed multiple times, but 'lock' itself is freed, so valgrind would complain about that too. It could also be a valgrind problem.
Comment 2 Zoltan Varga 2012-05-06 20:28:47 UTC
How can I reproduce this ?
Comment 3 Rolf Bjarne Kvinge [MSFT] 2012-05-08 16:42:45 UTC
Install valgrind.
Install MonoTouch and MonoDevelop from latest wrench build.
Open any MonoTouch project.
Add the following environment variable to the project (Project Options / Run / General):
    VALGRIND=/usr/local/bin/valgrind --tool=memcheck

Run (not debug) the project.
This should show up in the application output:

MonoTouch: Executing with valgrind: /usr/local/bin/valgrind --tool=memcheck
MonoTouch: You must execute 'gdb program 42696' and immediately detach for valgrind to start up properly

Do as the second line says. Once you've detached gdb, the app will startup and this message is printed.
Comment 4 Zoltan Varga 2012-05-09 19:31:47 UTC
I can reproduce this, but couldn't find any problem with the critical sections, they seem to be initialized properly, and only freed once.
Comment 5 Rodrigo Kumpera 2014-01-17 18:25:43 UTC
I've seen the same issue with valgrind, it looks like a false positive, that's all.