-
RWCString - any need to deallocate memory
Header File
void* m_buffer;
Constructor
m_buffer = (void *)new RWCString; //member variable intitialized in constructor
Destructor
if (m_buffer)
{
RWCString *pBuffer = (RWCString *)(m_buffer)
delete pStatementBuffer;
}
ClearData()
{
RWCString *pBuffer = (RWCString*)m_buffer;
*pBuffer = "";
}
void
AssignData(LPCTSTR format, ...)
{
char buffer[2048];
char *buffer_ptr = buffer;
va_list argList;
//used sprintf to create format and arglist to form sqlcommand and store in buffer_ptr
for e.g. sprintf(buffer_ptr, format, argList);
RWCString *pBuffer = (RWCString *)m_buffer;
pBuffer->append(buffer);
}
I have a hard time to understand, is this code causing any memory leak when ClearData is followed by AssignData is called repeatedly.
AssignData can be called multiple times in sequence with chunk of code which gets appended.
Similar Threads
-
Replies: 0
Last Post: 01-28-2011, 09:10 AM
-
Replies: 5
Last Post: 09-14-2010, 09:20 AM
-
Replies: 3
Last Post: 04-16-2010, 05:11 PM
-
Replies: 2
Last Post: 09-20-2009, 12:46 AM
-
By - John of Arc - in forum VB Classic
Replies: 14
Last Post: 04-29-2000, 02:58 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks