about Snmp class deteting

Jochen Katz katz____telematik.informatik.uni-karlsruhe.de
Thu Nov 30 11:10:47 CET 2000


Hi,

> Environment :snmp++2.6 on NT4.0 vc6.0
>  I decleared a pointer of Snmp class as global variable and
> new it in one function.
>  but when I want to delete the class the system says that
> i cannot read and write on a certain memory.
>   what is wrong?

this seems to be a problem of the original SNMP++ for Win32 from HP. I
tested this with the Unix version and didn't get any error. The message
below was sent to the winsnmp mailing list and should help you to fix
one bug in Snmp::notify_unregister().

Best regards,
  Jochen

---------------------------------------------
Subject: snmp++ bugs
   Date: Wed, 29 Nov 2000 21:05:35 +0200
   From: Rosinnes Roy <Roy.Rosinnes____ECITELE.COM>
     To: WINSNMP____mailbag.cps.intel.com

Hi all, 

I'm working on Win NT 4 (sp 5), using the snmp++ 2.8 and ace*comm
2.32.19990630. 

I seem to encounter problems when releasing the (dynamically created)
Snmp object. 

1. the notify_unregister function is called in the destructor of the
Snmp class.
as a good cleaning-my-own-mess programmer, I call the function myself
before releasing the object. when the destructor of the Snmp class calls
the
function - it crashes. this is traced down to the following lines in the
notify_unregister code:

   // free up local collections 
    if ( notify_targets != 0) 
       delete notify_targets; 

    if ( notify_ids != 0) 
       delete notify_ids; 
the pointers are freed - but are not set to 0. 

2. even though I clean up everything I'm responsible for (or at least I
think I
do...), when I try and delete the (dynamically created) Snmp object, I
encounter an access violation once the destructor returns, and the
process
stays in memory. If I do not delete the Snmp object (and create a memory
leak), the process terminates just fine.

3. in both cases I get the following message from the snmp_pp.dll: 
 SNMP_PP.DLL Terminating!       
 Detected memory leaks! 
 Dumping objects ->     
 {111} normal block at 0x01571660, 12 bytes long.       
 Data: <   w        > E0 A3 BC 77 00 00 00 00 CD CD CD CD 
        . 
        . 
        .       
 Object dump complete.  
 Thread 408 exited      
 with eventThread 365 exited    
 with eventThread 422 exited      

I'd be happy to receive your remarks/thoughts/corrections to my
problems. 

Thanks, 

Roy.



More information about the AGENTPP mailing list