![]() |
| | #1 |
| Registered User Join Date: Jun 2003
Posts: 218
| Checking for memory allocation...
__________________ 01011001 01101111 01110101 00100000 01110100 01101111 01101111 1101011 00100000 01110100 01101000 01101001 01110011 00100000 01101101 01110101 01100011 01101000 00100000 01110100 01101000 01101101 01100101 00100000 01110100 01101111 00100000 01110010 01100101 01100001 01100100 00100000 01011001 01101000 01101001 01110011 00111111 00100000 01000100 01100001 01101101 01101110 00100001 00000000 |
| kinghajj is offline | |
| | #2 |
| Registered User Join Date: Sep 2004 Location: California
Posts: 3,020
| alloc is very implementation specific, so in short - the answer is no. Now you could hack your alloc functions to see how they are implemented on your system and then use that to find a solution to your problem, but it wouldn't be easy. Now the fact that you are asking this question in the first place means that you have a design problem somewhere in your program. When malloc is called, you are the one which specifies how much memory to set aside, therefore if you need to know this size in the future - come up wich a mechanism of storing the memory size somewhere. It could be something as simple as: Code: typedef struct _memloc
{
unsigned char* pmem;
size_t memsize;
} memloc, *pmemloc;
|
| bithub is offline | |
| | #3 |
| Registered User Join Date: Jun 2003
Posts: 218
| It's not my design problem, it's a problem in problem NerveBreak (http://nervebreak.sf.net/). I'm just trying to find a way around it.
__________________ 01011001 01101111 01110101 00100000 01110100 01101111 01101111 1101011 00100000 01110100 01101000 01101001 01110011 00100000 01101101 01110101 01100011 01101000 00100000 01110100 01101000 01101101 01100101 00100000 01110100 01101111 00100000 01110010 01100101 01100001 01100100 00100000 01011001 01101000 01101001 01110011 00111111 00100000 01000100 01100001 01101101 01101110 00100001 00000000 |
| kinghajj is offline | |
| | #4 |
| Gawking at stupidity Join Date: Jul 2004
Posts: 2,324
| Or why not implement a type variable so instead of guessing you can tell for sure?
__________________ If you understand what you're doing, you're not learning anything. Ignore any "advice" esbo tries to give you. It's wrong. |
| itsme86 is offline | |
| | #5 |
| & the hat of GPL slaying Join Date: Sep 2001
Posts: 5,732
| Try reading it and if you seg fault then you know you aren't allowed to use it |
| Thantos is offline | |
| | #6 | |
| Registered User Join Date: Jun 2003
Posts: 218
| Quote:
__________________ 01011001 01101111 01110101 00100000 01110100 01101111 01101111 1101011 00100000 01110100 01101000 01101001 01110011 00100000 01101101 01110101 01100011 01101000 00100000 01110100 01101000 01101101 01100101 00100000 01110100 01101111 00100000 01110010 01100101 01100001 01100100 00100000 01011001 01101000 01101001 01110011 00111111 00100000 01000100 01100001 01101101 01101110 00100001 00000000 | |
| kinghajj is offline | |
| | #7 |
| Registered User Join Date: Sep 2004 Location: California
Posts: 3,020
| of course reading invalid memory doesn't always result in a seg fault either ![]() Nervebreak appears to be opensource. It would be far easier to fix the problem there, than doing some hack in your own code. |
| bithub is offline | |
| | #8 | |
| UT2004 Addict Join Date: Dec 2004
Posts: 645
| Quote:
Code: #define JLKJWERSDFDF std::cout | |
| Kleid-0 is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| dynamic allocation from 1 instead of zero | cfdprogrammer | C Programming | 27 | 04-28-2009 08:21 AM |
| Checking memory allocation | JoeBloggs | C Programming | 5 | 12-09-2008 05:01 AM |
| Profiler Valgrind | afflictedd2 | C++ Programming | 4 | 07-18-2008 09:38 AM |
| Interpreter.c | moussa | C Programming | 4 | 05-28-2008 05:59 PM |
| Problems about gcc installation | kevin_cat | Linux Programming | 4 | 08-09-2005 09:05 AM |