[PATCH 2/5] wined3d: Wrap resource->heapMemory into a structure

Stefan Dösinger stefandoesinger at gmail.com
Mon Aug 19 10:27:51 CDT 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 2013-08-19 17:08, schrieb Stefan Dösinger:
> I'm not entirely sure about the SIZE_T align = RESOURCE_ALIGNMENT -
> 1 + sizeof(*p); line though. Msvcrt doesn't have the - 1, and
> allocating size + RESOURCE_ALIGNMENT bytes might be enough. msvcrt
> allocates the equivalent of size + RESOURCE_ALIGNMENT + sizeof(void
> *).
After going through all the possibilities I concluded that size +
alignment + sizeof(void *) - 1 is the smallest allocation size. The
worst case is a pointer of the form n * alignment - sizeof(void *) -
1. In this case we need sizeof(void *) - 1 bytes to get to the next
aligned address and then alignment bytes to store our real alloc pointer.

Not sure why msvcrt allocates one extra byte. Probably because
allocations below 4 or 8 bytes don't matter anyway.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.20 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJSEjl3AAoJEN0/YqbEcdMw/JAP/iw92FaWRGOMoOMToYTuBqyC
K9xgwOXxPuViICgR92uAMv1K/vn+38WWmuTULGKjRx9qdddOBEuYd2cIS1xUjLub
laegv8EIxn/g426xqjZ8mSqXBrFyHMhGVTREuWbr4G4yIH2CB+yzmIg7IObgaPoS
G9Gleeg0+pjzyPnqdCy9NWu/HEWDKVQ4Zdqms2oBmgfpPNtSblwh/BFeoIf5+eON
4hzIcY+rYKK0prGaJ7GEVFIocLqZJuF4Z6KiDS+jg4jRx6pCXQ+m1GcNDb90fYZX
i8nWO2TfVmTZ8j5yb3Z5YTW5C/3UIQDJhBlKCqZyu2FhR+PTDzTEnWow9fp1kfCK
KHZYcJmomSRQX+xWinjKAqatzUtsM2HbT+cyUeiQKVVpSNOjSFCM6tzsT0q9/PQd
89G4kfPIwArKyNHffNXeiuEWTKYY4/a3E5/E4dbIFxVvxrqxaeg5jDuG6Ic0LQK/
IEAfJHH5LLwM6Ef3s3lWmkgRTMYE1oWyys5uP0Ht3C0xUoomohpXQrrgRZNfTjtL
J49rvEQ+yZKPPrXOqjLtIwKFC/mdb3/4x33b2UMob5HRN7Jjusvg7OefqYmOGprr
UFB0iIwg7oOuqThZ+Ce5jnu5p0vvvPYq1vEuW7Oz/wth+aENibNatvKnJFj/tWOe
i40GHsaztVcRtNGbZsap
=zZYQ
-----END PGP SIGNATURE-----



More information about the wine-devel mailing list