home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.os.vms      DEC's VAX* line of computers & VMS.      264,096 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 263,902 of 264,096   
   =?UTF-8?Q?Arne_Vajh=C3=B8j?= to Simon Clubley   
   Re: more CMA   
   04 Dec 25 14:12:39   
   
   From: arne@vajhoej.dk   
      
   On 12/4/2025 1:29 PM, Simon Clubley wrote:   
   > On 2025-12-04, Arne Vajhøj  wrote:   
   >>   
   >> A sequence of:   
   >>   
   >> cma_thread_create   
   >> cma_mutex_lock   
   >> cma_mutex_unlock   
   >> cma_thread_join   
   >>   
   >> and after a little over 10000 iterations:   
   >>   
   >> %SYSTEM-F-INSFMEM, insufficient dynamic memory   
   >> %TRACE-F-NOMSG, Message number 00098054   
   >> %TRACE-I-NOMSG, Message number 00098043   
   >>   
   >   
   > Resource leak ?   
      
   Definitely.   
      
   But the code is rather simple.   
      
   Shortest reproducer:   
      
   #include    
   #include    
      
   #include    
   #include    
      
   void *run(void *p)   
   {   
        if(p != NULL) printf("arg pointer = %p\n", p);   
        return NULL;   
   }   
      
   int main()   
   {   
        cma_t_thread t;   
        cma_t_exit_status stat;   
        void *p;   
        cma_init();   
        int n = 0;   
        while(1)   
        {   
            cma_thread_create(&t, &cma_c_null, run, NULL);   
            cma_thread_join(&t, &stat, &p);   
            if(p != NULL) printf("return pointer = %p\n", p);   
            n++;   
            printf("%d\n", n);   
        }   
        return 0;   
   }   
      
   That code is not doing much.   
      
   With this code I get the problem after 16431 good iteration   
   and a stack trace.   
      
   16429   
   16430   
   16431   
   %SYSTEM-F-INSFMEM, insufficient dynamic memory   
   %TRACE-F-NOMSG, Message number 00098054   
   image     module    routine               line      rel PC           abs PC   
   PTHREAD$RTL                                  0 000000008001DA53   
   FFFF8300088DDA53   
   CMA$OPEN_RTL                                 0 0000000080003848   
   FFFF830008F52848   
   CMA$OPEN_RTL                                 0 00000000800000FC   
   FFFF830008F4F0FC   
   z  Z  main                               12400 000000000000008F   
   000000008000008F   
   z  Z  __main                             12391 0000000000000113   
   0000000080000113   
   PTHREAD$RTL                                  0 000000008003F28C   
   FFFF8300088FF28C   
   PTHREAD$RTL                                  0 0000000080000331   
   FFFF8300088C0331   
                                                 0 FFFF8300071C81C6   
   FFFF8300071C81C6   
   DCL                                          0 000000008006632B   
   000000007ADC432B   
   %TRACE-I-NOMSG, Message number 00098043   
      
   Line 12400 is:   
      
          2   12400         cma_thread_create(&t, &cma_c_null, run, NULL);   
      
   So cma_thread_create allocate some resources and   
   cma_thread_join does not free them all and eventually   
   this runs out of resources.   
      
   That was on x86-64. On my Alpha is goes to 18808:   
      
   18806   
   18807   
   18808   
   %SYSTEM-F-INSFMEM, insufficient dynamic memory   
   %TRACE-F-TRACEBACK, symbolic stack dump follows   
      image    module    routine             line      rel PC           abs PC   
     PTHREAD$RTL                                0 000000000004310C   
   FFFFFFFF80A3B10C   
     CMA$OPEN_RTL                               0 00000000000301D4   
   FFFFFFFF80C8C1D4   
     z                                          0 0000000000020184   
   0000000000020184   
     z                                          0 00000000000200DC   
   00000000000200DC   
     PTHREAD$RTL                                0 0000000000056728   
   FFFFFFFF80A4E728   
     PTHREAD$RTL                                0 0000000000030444   
   FFFFFFFF80A28444   
                                                0 FFFFFFFF80340964   
   FFFFFFFF80340964   
   %TRACE-I-END, end of TRACE stack dump   
      
      
   Arne   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca