Bug #73272 Reduce two memset to one memset call for upd_create call.
| Submitted: | 11 Jul 2014 6:10 | Modified: | 26 Aug 2014 13:08 |
|---|---|---|---|
| Reporter: | Fangxin Flou (OCA) | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: InnoDB storage engine | Severity: | S5 (Performance) |
| Version: | 5.6.19 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | Contribution, innodb, Memory | ||
[25 Jul 2014 19:45]
Sveta Smirnova
Thank you for the contribution!
[26 Aug 2014 13:08]
Daniel Price
Fixed as of the upcoming 5.7.5 release, and here's the changelog entry: Reduced "mem_heap_zalloc" calls in "upd_create". Only a single call is necessary to allocate memory for "upd_t". Thank you for the bug report.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.052 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: Reduce two memset to one memset call for upd_create call. UNIV_INLINE upd_t* upd_create( /*=======*/ ulint n, /*!< in: number of fields */ mem_heap_t* heap) /*!< in: heap from which memory allocated */ { upd_t* update; update = (upd_t*) mem_heap_zalloc(heap, sizeof(upd_t)); update->n_fields = n; update->fields = (upd_field_t*) mem_heap_zalloc(heap, sizeof(upd_field_t) * n); return(update); } there is no need to use two mem_heap_zalloc call. How to repeat: N/A Suggested fix: diff -rc --exclude='*.orig' --exclude=sql_yacc.cc --exclude=sql_yacc.h mysql-5.6.19/storage/innobase/include/row0upd.ic mysql-5.6.19-patched/storage/innobase/include/row0upd.ic *** mysql-5.6.19/storage/innobase/include/row0upd.ic 2014-05-06 18:45:59.000000000 +0800 --- mysql-5.6.19-patched/storage/innobase/include/row0upd.ic 2014-07-11 14:01:53.000000000 +0800 *************** *** 44,54 **** { upd_t* update; ! update = (upd_t*) mem_heap_zalloc(heap, sizeof(upd_t)); update->n_fields = n; ! update->fields = (upd_field_t*) ! mem_heap_zalloc(heap, sizeof(upd_field_t) * n); return(update); } --- 44,56 ---- { upd_t* update; ! /* update = (upd_t*) mem_heap_zalloc(heap, sizeof(upd_t)); */ ! update = (upd_t*) mem_heap_zalloc(heap, sizeof(upd_t) + sizeof(upd_field_t) * n); update->n_fields = n; ! /* update->fields = (upd_field_t*) ! mem_heap_zalloc(heap, sizeof(upd_field_t) * n); */ ! update->fields = (upd_field_t*)(&update[1]); return(update); }