pgpoolII3.1 的内存泄漏(三)

磨砺技术珠矶,践行数据之道,追求卓越价值
回到上一级页面: PostgreSQL集群方案相关索引页     回到顶级页面:PostgreSQL索引页
[作者 高健@博客园  luckyjackgao@gmail.com]

用valgrind来分析pgpool的执行,会看到有如下几种情形有可能产生内存泄漏:

A    extract_string 调用  strdup                                    
                                        
==27927== 3 bytes in 1 blocks are possibly lost in loss record 3 of 100 
==27927==    at 0x4A05E1C: malloc (vg_replace_malloc.c:195) 
==27927==    by 0x3C51E798C1: strdup (in /lib64/libc-2.5.so)
==27927==    by 0x40C9C4: extract_string (pool_config.l:2065)
==27927==    by 0x410D52: pool_get_config (pool_config.l:1756)
==27927==    by 0x4066B5: main (main.c:320)                                        
==27927==                                         
                                                                     
B    read_startup_packet  调用 calloc                                    
                                        
==27927== 594 (528 direct, 66 indirect) bytes in 11 blocks are definitely lost in loss record 85 of 100                                        
==27927==    at 0x4A05140: calloc (vg_replace_malloc.c:418) 
==27927==    by 0x40895B: read_startup_packet (child.c:803) 
==27927==    by 0x409663: do_child (child.c:210) 
==27927==    by 0x403F04: fork_a_child (main.c:1073) 
==27927==    by 0x406C00: main (main.c:550)                                        
==27927==                            
                                        
C    save_ps_display_args  调用 malloc                                    
                                        
==27927== 1,602 (256 direct, 1,346 indirect) bytes in 1 blocks are definitely lost in loss record 92 of 100                                        
==27927==    at 0x4A05E1C: malloc (vg_replace_malloc.c:195)  
==27927==    by 0x434605: save_ps_display_args (ps_status.c:173)
==27927==    by 0x403ECA: fork_a_child (main.c:1066) 
==27927==    by 0x406C00: main (main.c:550)                                        
==27927==                              
                                        
D    extract_string_tokens 调用 malloc                                    
                                        
==27927== 24,630 (24,576 direct, 54 indirect) bytes in 3 blocks are definitely lost in loss record 100 of 100                                        
==27927==    at 0x4A05E1C: malloc (vg_replace_malloc.c:195) 
==27927==    by 0x40C8FC: extract_string_tokens (pool_config.l:2191)
==27927==    by 0x41177B: pool_get_config (pool_config.l:1657) 
==27927==    by 0x4066B5: main (main.c:320)                                        
==27927==                                         

后面将陆续对其进行分析。

[作者 高健@博客园  luckyjackgao@gmail.com]
回到上一级页面: PostgreSQL集群方案相关索引页     回到顶级页面:PostgreSQL索引页
磨砺技术珠矶,践行数据之道,追求卓越价值

原文地址:https://www.cnblogs.com/gaojian/p/2648982.html