malloc, new with cross-compiler gcc 2.95.3 on ARM9

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I 'd like to have malloc and new which returns NULL if lack of memory on
embedded system Linux kernel 2.4.19-rmk7.
I was successful to set this behavior with the newest compiler on "big"
Linux + gcc 4.1.2 and also on embedded Linux kernel 2.4.19-rmk7 on ARM9 +
cross-compiler gcc 3.4.3 by this way:

for malloc:

mlockall(MCL_FUTURE);
char* ptr = (char*)malloc(xxxxxx);
if(ptr == NULL)	{
	//handle out of memory, functional
}

for new operator:

mlockall(MCL_FUTURE);
char* ptr = (char*) new(std:nothrow) char[xxxxx];
if(ptr == NULL)	{
	//handle error - functional
}

Problem is that I am not able to set this behavior on 
embedded kernel 2.4.19-rmk7 + older cross-compiler 2.95.3.

In this case system outputs to console:
Out of Memory: Killed process 99 (memorysample).
Terminated

Do you think that there exist some solution also for older cross-compiler
2.95.3 ?

Regards !
Peter


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux