![]() |
|
#1
|
|||
|
|||
out of memory problemsHi 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
|
|||
|
|||
Re: out of memory problemsI 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 GIDBlog
Toyota - 2008 September Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
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