Re: [RFC PATCH] docs/devel: expand style section of memory management

2021-03-16 Thread Markus Armbruster
Daniel P. Berrangé writes: > On Mon, Mar 15, 2021 at 06:04:10PM +0100, Thomas Huth wrote: >> On 15/03/2021 17.57, Peter Maydell wrote: >> > On Mon, 15 Mar 2021 at 16:53, Alex Bennée wrote: >> > > -Prefer g_new(T, n) instead of g_malloc(sizeof(T) ``*`` n) for the >> > > following >> > > +Care sh

Re: [RFC PATCH] docs/devel: expand style section of memory management

2021-03-15 Thread Daniel P . Berrangé
On Mon, Mar 15, 2021 at 05:54:17PM +, Alex Bennée wrote: > > Daniel P. Berrangé writes: > > > On Mon, Mar 15, 2021 at 06:04:10PM +0100, Thomas Huth wrote: > >> On 15/03/2021 17.57, Peter Maydell wrote: > >> > On Mon, 15 Mar 2021 at 16:53, Alex Bennée wrote: > >> > > -Prefer g_new(T, n) inst

Re: [RFC PATCH] docs/devel: expand style section of memory management

2021-03-15 Thread Alex Bennée
Daniel P. Berrangé writes: > On Mon, Mar 15, 2021 at 06:04:10PM +0100, Thomas Huth wrote: >> On 15/03/2021 17.57, Peter Maydell wrote: >> > On Mon, 15 Mar 2021 at 16:53, Alex Bennée wrote: >> > > -Prefer g_new(T, n) instead of g_malloc(sizeof(T) ``*`` n) for the >> > > following >> > > +Care

Re: [RFC PATCH] docs/devel: expand style section of memory management

2021-03-15 Thread Daniel P . Berrangé
On Mon, Mar 15, 2021 at 06:04:10PM +0100, Thomas Huth wrote: > On 15/03/2021 17.57, Peter Maydell wrote: > > On Mon, 15 Mar 2021 at 16:53, Alex Bennée wrote: > > > -Prefer g_new(T, n) instead of g_malloc(sizeof(T) ``*`` n) for the > > > following > > > +Care should be taken to avoid introducing p

Re: [RFC PATCH] docs/devel: expand style section of memory management

2021-03-15 Thread Thomas Huth
On 15/03/2021 17.57, Peter Maydell wrote: On Mon, 15 Mar 2021 at 16:53, Alex Bennée wrote: -Prefer g_new(T, n) instead of g_malloc(sizeof(T) ``*`` n) for the following +Care should be taken to avoid introducing places where the guest could +trigger an exit. For example using ``g_malloc`` on sta

Re: [RFC PATCH] docs/devel: expand style section of memory management

2021-03-15 Thread Peter Maydell
On Mon, 15 Mar 2021 at 16:53, Alex Bennée wrote: > -Prefer g_new(T, n) instead of g_malloc(sizeof(T) ``*`` n) for the following > +Care should be taken to avoid introducing places where the guest could > +trigger an exit. For example using ``g_malloc`` on start-up is fine > +if the result of a fai