It is currently Wed Jun 28, 2017 10:58 pm

All times are UTC - 5 hours




 Page 1 of 1 [ 2 posts ] 
Author Message
 Post subject: Network VMK 10 - Memory Cleanup
PostPosted: Wed Aug 10, 2011 5:05 am 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1094
Location: Ontario Canada
In this video I cleanup the code used to allocate and deallocate dynamic memory in the network manager using the unique_ptr class. After this smart pointer is introduced, we won't have to call delete explicitly.


Offline
 Profile  
 
 Post subject: Re: Network VMK 10 - Memory Cleanup
PostPosted: Wed Aug 10, 2011 6:12 am 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1094
Location: Ontario Canada
Just a note about the null terminator in the initialization string for the UDP connection. At the end of the video I confused myself!

The UDP Client is NOT sending the NULL character over to the server, however because we are now using std::vector<char> to hold the received data, by allocating iLeft+1 characters we automatically null terminate the received string which is only iLeft characters long.

Therefore you can remove this line of code from the setupUdpClient function and it will not make any difference:
vReceivedString[ s_strUdpInitString.size() ] = NULL; //REMOVE THIS LINE OF CODE


Offline
 Profile  
 
Display posts from previous:  Sort by  
 Page 1 of 1 [ 2 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to:  

cron