[PATCH] Mystery hang reduction -- clear new allocations
From: Max TenEyck Woodbury <max+git(a)mtew.isa-geek.net> I was getting mystery frozen processes that cleared when a total screen redraw was forced. This has been reported numerous times over several years. It came and went with various releases. I have been getting it consistantly recently. I had an idea that it might have something to do with partially uninitialized drawing data structures, so I started adding HEAP_ZERO_MEMORY flags in various places. This particular set cleared the problem, at least for now... diff --git a/dlls/wined3d/vertexdeclaration.c b/dlls/wined3d/vertexdeclaration.c index cf5378c..cf1c814 100644 --- a/dlls/wined3d/vertexdeclaration.c +++ b/dlls/wined3d/vertexdeclaration.c @@ -178,7 +178,8 @@ static HRESULT vertexdeclaration_init(struct wined3d_vertex_declaration *declara declaration->parent = parent; declaration->parent_ops = parent_ops; declaration->device = device; - declaration->elements = HeapAlloc(GetProcessHeap(), 0, sizeof(*declaration->elements) * element_count); + declaration->elements = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + sizeof(*declaration->elements) * element_count); if (!declaration->elements) { ERR("Failed to allocate elements memory.\n"); @@ -316,7 +317,7 @@ static unsigned int convert_fvf_to_declaration(const struct wined3d_gl_info *gl_ has_psize + has_diffuse + has_specular + num_textures; state.gl_info = gl_info; - state.elements = HeapAlloc(GetProcessHeap(), 0, size * sizeof(*state.elements)); + state.elements = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size * sizeof(*state.elements)); if (!state.elements) return ~0U; state.offset = 0; state.idx = 0; -- 1.8.0.rc0.18.gf84667d
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 2014-10-30 07:09, schrieb mtewoodbury(a)gmail.com:
From: Max TenEyck Woodbury <max+git(a)mtew.isa-geek.net>
I was getting mystery frozen processes that cleared when a total screen redraw was forced. This has been reported numerous times over several years. It came and went with various releases. I have been getting it consistantly recently. I had an idea that it might have something to do with partially uninitialized drawing data structures, so I started adding HEAP_ZERO_MEMORY flags in various places. This particular set cleared the problem, at least for now... I don't understand the description. What do you mean with forcing a total screen redraw? Which Windows applications were affected? What's the symptom of a freeze? A game being stuck for half a second? A game being stuck forever until you kill it?
- declaration->elements = HeapAlloc(GetProcessHeap(), 0, sizeof(*declaration->elements) * element_count); + declaration->elements = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + sizeof(*declaration->elements) * element_count); I'd expect 1 byte padding at the end of the structure because the structure has only 19 bytes (23 in 64 bit). This may cause issues if we're doing a memcmp over a vertex declaration or one or more vertex declaration elements. I am not aware that we're doing such a thing though.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBAgAGBQJUVnJFAAoJEN0/YqbEcdMwzOYP+QHBOqtPptgmlerJvRxXERcT 2PgmdiJH4T9jjqU7B1rVUypHP8IDNrZk8uKFsEAk0todD5TROznIv17LPwImrqfY 2lr6Y9zFlelxAicOYykXrqsvSDBY/VF+r/MdK+4YfIywVe0SHh52nnHGo7XdF9gj 7yqRJ3chU0UX0ANotSiyG4+d2yezrP+OI0kcKNvWH45QdB9QU/maUE6mCDoBS+g1 iYZuFC/V36PJVucsIrbztXG09jgAonrjYg2uqp4DpGnI3BFdo4pr6Pmel2DmLqw8 nw6rDyL/wGf5eBZ+/jLJFilk2nNz5C8b+Xqt0Vx+T3SG3A1AfOw56M/LxsQcrThC i34DRzNhg9ybiTcpBHlvm4QPPX84Uk0c7ryKj1r3ACQ79U+svpoyEHd37uyIert0 OlsqQGSSce+NNOnqVCaBNwJqlCGJfhD8gpS56snmbZ6UTTSHUWXokdc9K7uyp0WO mEegeE/iG78XOYerOkjmP3W64EI/xHqW5stZ3bHjg1STQkhWvNx2HxDuCMKP0192 pUzUMoGP911wOi+Q1QsS5B1sWZi3+oN4mYB+Ez7wE1eQRkTyU2oNkvrI0HmE81Dg htyV9u1DVpx4l+evqm47/LZTOWMqQGI6+HgT/4jnFRkLWVvPQqsbEU+fdVIEtPB6 6Mwj7Or/tE2W51ZQICms =XRF3 -----END PGP SIGNATURE-----
participants (2)
-
mtewoodbury@gmail.com -
Stefan Dösinger