Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita1e1ef4

Browse files
committed
Avoid a memory allocation in the backend startup code, to avoid having to check
whether it failed. Modelled after catcache.c's usage of DlList, per suggestionfrom Tom.
1 parentd85c688 commita1e1ef4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎src/backend/postmaster/postmaster.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.578 2009/05/02 22:02:37 tgl Exp $
40+
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.579 2009/05/0402:24:17 alvherre Exp $
4141
*
4242
* NOTES
4343
*
@@ -143,6 +143,7 @@ typedef struct bkend
143143
longcancel_key;/* cancel key for cancels for this backend */
144144
boolis_autovacuum;/* is it an autovacuum process? */
145145
booldead_end;/* is it going to send an error and quit? */
146+
Dlelemelem;/* self pointer into BackendList */
146147
}Backend;
147148

148149
staticDllist*BackendList;
@@ -2459,7 +2460,6 @@ CleanupBackend(int pid,
24592460
#endif
24602461
DLRemove(curr);
24612462
free(bp);
2462-
DLFreeElem(curr);
24632463
break;
24642464
}
24652465
}
@@ -2506,7 +2506,6 @@ HandleChildCrash(int pid, int exitstatus, const char *procname)
25062506
#endif
25072507
DLRemove(curr);
25082508
free(bp);
2509-
DLFreeElem(curr);
25102509
/* Keep looping so we can signal remaining backends */
25112510
}
25122511
else
@@ -3014,7 +3013,8 @@ BackendStartup(Port *port)
30143013
bn->is_autovacuum= false;
30153014
bn->dead_end= (port->canAcceptConnections!=CAC_OK&&
30163015
port->canAcceptConnections!=CAC_WAITBACKUP);
3017-
DLAddHead(BackendList,DLNewElem(bn));
3016+
DLInitElem(&bn->elem,bn);
3017+
DLAddHead(BackendList,&bn->elem);
30183018
#ifdefEXEC_BACKEND
30193019
if (!bn->dead_end)
30203020
ShmemBackendArrayAdd(bn);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp