GIDForums  

Go Back   GIDForums > Computer Programming Forums > MS Visual C++ / MFC Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 24-Apr-2006, 17:43
pixienick pixienick is offline
New Member
 
Join Date: Aug 2005
Posts: 23
pixienick is on a distinguished road

out of memory problems


Hi there
I got this problem allocating memory. I've got this class that holds a texture. At one point i create the texture. To do this i create some memory using new unsigned char[a few meg], store the pixels in it, send it to opengl and then delete the memory. The texture is still displayed by opengl. In another member function of the class i want to write the memory to a jpeg. I need to create the same memory again and load it with the pixels again. When i allocate memory with this other function i get a message box at the point where 'new' fails saying i am out of memory. But i can still create more textures without problems. I've used the same pointer both times to create new memory. So i created the pointer with memory, deleted it and tried to 'new' it again, that didnt work. I tried deleting it then making it equal NULL then rellocated it, that just crashed the program. And I tried creating a local one within the function and that gave the message box again.
What am i doing wrong?
Thanks for any help
  #2  
Old 25-Apr-2006, 12:37
pixienick pixienick is offline
New Member
 
Join Date: Aug 2005
Posts: 23
pixienick is on a distinguished road

Re: out of memory problems


I solved the problem but not very nicely. I had to make the data public and call the new function from outside the class's member functions. Weird
 
 

Recent GIDBlogToyota - 2008 September Promotion by Nihal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Selling Server darkneal128 Managed / Dedicated Servers 4 28-Mar-2006 17:01
Memory allocation issue kobi_hikri C++ Forum 6 27-Oct-2005 12:16
Pointer Usage in C++: Beginner to Advanced varunhome C++ Forum 0 19-Aug-2005 09:25
[Tutorial] Pointers in C (Part II) Stack Overflow C Programming Language 0 27-Apr-2005 17:36
[Tutorial] Pointers in C (Part I) Stack Overflow C Programming Language 1 08-Apr-2005 18:35

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 17:54.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.