This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CMEM, segmentation fault, CMEM alloc issues

Hi,

  I have a cmem error when I try to alloc 6782976 bytes with the OSA_cmemAlloc (the function is shown below, alignment is 32). I get the following error:

CMEM Error: allocHeap: ioctl CMEM_IOCALLOCHEAP failed: -1                      
ERROR  (mcvip/src/capture_tsk.c|CAPTURE_tskCreate|63): OSA_cmemAlloc()        
ERROR  (vcapture.c|UI_sysStart|150): CAPTURE_create()  

It seems to me I should have enough space to alloc my buffer. Someone has some idea of the possible cause of the issue. In the previous days I always had "segmentation fault" errors.

This is the cmem message when I load the module:

CMEMK module: built on Mar 17 2010 at 16:12:26                                 
  Reference Linux version 2.6.18                                               
  File /home/user/dvsdk_2_10_01_18/linuxutils_2_24_02/packages/ti/sdo/linuxutilc
ioremap_nocache(0x85000000, 50331648)=0xc6000000                               
allocated heap buffer 0xc6000000 of size 0x134000                              
cmem initialized 20 pools between 0x85000000 and 0x88000000                    
CMEM Range Overlaps Kernel Physical - allowing overlap                         
CMEM phys_start (0x1000) overlaps kernel (0x80000000 -> 0x84c00000)            
ioremap_nocache(0x1000, 28672)=0xc5078000                                      
no remaining memory for heap, no heap created for memory block 1               
cmem initialized 1 pools between 0x1000 and 0x8000   

Here the alloc function.

Uint8 *OSA_cmemAlloc(Uint32 size, Uint32 alignment)
{
  CMEM_AllocParams  prm;
  Uint8 *virtAddr;
 
  prm.type = CMEM_HEAP;
  prm.flags = CMEM_NONCACHED;
  prm.alignment = alignment;
 
  virtAddr = (Uint8*)CMEM_alloc(size, &prm);
 
  #ifdef OSA_DEBUG_CMEM 
  OSA_printf(" OSA_CMEM: %08x %d bytes\n", (Uint32)virtAddr, size );   
  #endif
     
  return virtAddr;
}

Thank you for your support.

 

 

  • Your insmod output from CMEM shows that there was, after pool allocations, 0x134000 left for the CMEM heap, and your OSA_cmemAlloc() function performs only CMEM_HEAP allocations, so that explains why it's failing.

    Either allow more for your CMEM heap (by reducing the pool allocations, since what's left over after allocating pools is used for the CMEM heap), or change the function to do CMEM_POOL allocations.

    Regards,

    - Rob

  • Thank you Robert, you are right. Whan I remove the pools I can allocate my buffers.

    Thank you.

    mario