On Sat, Mar 9, 2013 at 3:55 PM, Anton Shterenlikht <[email protected]>wrote:
> I run a program that uses large arrays.
> I don't want it to use swap, because it's
> too slow. I want the program to fail when
> there's not enough RAM, rather than using
> swap. How to do this?
>
> Is it something to do with these kernel
> variables:
>
> kern.dfldsiz: 34359738368
> kern.dflssiz: 8388608
>
> kern.maxdsiz: 34359738368
> kern.maxssiz: 536870912
> kern.maxtsiz: 134217728
>
> Many thanks
>
> Anton
>
If you have program source , you may do the following :
Define a constant : Maximum_Allocatable_Memory = ?
Define a variable : Total_Allocated_Memory = 0
Before allocating a memory of size M ,
check whether Total_Allocated_Memory + M < Maximum_Allocatable_Memory
If yes : Allocate memory ;
Add M to Total_Allocated_Memory .
If no :
Return an error and gracefully stop your program instead of a crash which
will loose data .
Thank you very much .
Mehmet Erol Sanliturk
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[email protected]"