Raised This Month: $32 Target: $400
 8% 

[Help] Vectors and Pointers


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 09-23-2014 , 22:34   [Help] Vectors and Pointers
Reply With Quote #1

I was trying to use CVector class like below.

PHP Code:
CVector <String *> g_Container;
 
void fnStart(void)
{
  
String pString = new String;
  
pString->assign("Hattrick");
  
g_Container.push_back(pString);
}
 
void fnEnd(void)
{
  for (
CVector <String *>::iterator Iterator g_Container.begin(); Iterator != g_Container.end(); Iterator++)
  {
    
delete (*Iterator);
  }
  
g_Container.clear();

AMX Mod X's MMGR displays me memory leaks. Got any suggestions? I'd like to use something like listed below.

PHP Code:
void ** pData;
int Count 0U;
pData[0U] = (void *) new char[512U];
pData[1U] = (void *) new char[512U];
Count 2U;
delete [] pData[0U];
delete [] pData[1U];
Count 0U
Thank you for reading. I don't want to use std namespace.
__________________

Last edited by claudiuhks; 09-23-2014 at 22:35.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 09-24-2014 , 10:01   Re: [Help] Vectors and Pointers
Reply With Quote #2

Fixed, somehow. I am a bit confused. I wasn't sure what caused the memory leak(s) but I see it's working now.
I'm sorry and I couldn't be sure since MMGR doesn't tell much.

Pastebin. Working like a charm.
__________________

Last edited by claudiuhks; 09-24-2014 at 10:02.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:29.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode