experimental alternate memory allocation - page 8 - General Discussion and Assistance - CHDK Forum

experimental alternate memory allocation

  • 128 Replies
  • 54710 Views
*

Offline whim

  • ******
  • 2046
  • A495/590/620/630 ixus70/115/220/230/300/870 S95
Re: experimental alternate memory allocation
« Reply #70 on: 04 / February / 2011, 09:43:16 »
Advertisements
@Bernd

You can easily check that yourself ... Win 7 (XP too, with an update) can format cards (even < 32 GB)
as exFAT. If you don't have a PS.FI2, you will need to to partition your card as usual, and then re-format
the "large" partitions as exFAT.

HTH,

wim

BTW Long file name support depends on the Canon OS, not the card type (e.g. VxWorks cams have it)

edit: just tested on ixus300/SD4000 with CHDK (p::d's beta 9 PS.FI2) on exFAT card (128 MB):  
       filebrowser shows up to 14 characters + ~ = the maximum that fits the column.
« Last Edit: 04 / February / 2011, 10:06:36 by whim »

Re: experimental alternate memory allocation
« Reply #71 on: 04 / February / 2011, 10:27:04 »
@whim, thanks for testing it.so sdxc is no problem.

I do some more tests with exmem on IX1000 and the testcode to show trashed values.I am now 99.99 % sure, it can use 3 megabyte of exmem.

when alloc 8 megabyte address begin from 0x77fffe0 and values after 0x7946c00 are always partly overwritten when show or record video.this are 1.3 megabytes, maybe there are some 512 kb gaps on it later, i have not test more.

when i init exmem with 16 megabyte, then low address is 0x6ffffe0 high address is 0x77fffe0.
its true, video recording do not overwrite this address space, so have real 16 megabyte.

you can do videorecording and showing without memtrash.but as soon you shoot an image, camera crash.
so 16 megabyte cant use really.

A good working is between both, i use 10 megabyte here  

#define EXMEM_HEAP_SIZE (1024*1024*10)

and later 3 megabyte are used.

exmem_heap = suba_init(mem,(1024*1024*3) ,1,1024);

this use address range from 75fffe0-78fffe0
I get no overwrite of this addresses during record video, and do the diffrent shooting modes as handheld nighshoot and all the other.I try also cut Video, do icontrast, vivid mode.

during test of vivid mode i find out, that vivid standard is the correct natural color mode, i see too when i do RAW images.
all other modes even no mode select give no perfect natural colors.
« Last Edit: 04 / February / 2011, 10:34:51 by Bernd R »
Ixus 1000 HS

*

Offline whim

  • ******
  • 2046
  • A495/590/620/630 ixus70/115/220/230/300/870 S95
Re: experimental alternate memory allocation
« Reply #72 on: 04 / February / 2011, 11:04:13 »
@Bernd

forgot to add that, under the exact same conditions, on a FAT32 card there still is no LFN support ...

wim

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: experimental alternate memory allocation
« Reply #73 on: 19 / February / 2011, 18:29:08 »
I took over 1300 photos and videos on the SX30 with the EXMEM memory manager enabled, and had no problems. I also had this enabled on the G12 and did not have any problems until another bug surfaced that forced me to turn off CHDK on the G12.

This was with a heap size of 2MB and included my hack to ensure that the video memory buffers got excluded from the allocated block (as described previously).

I've done some more testing and can't (yet) find any way to guarantee that the video buffers are excluded correctly.

Below is my thoughts on code changes that would allow my hack to be included in the main code trunk without having camera specific ifdef's all over the place. Your thoughts on this would be appreciated.

In camera.h add the following define for the SX30 and G12. This defines how much memory we need to ignore.
Code: [Select]
#define EXMEM_HEAP_SKIP (0x08000000-0x07D08A00) // G12 & SX30 uses movie memory buffers at the top of the memory allocated by exmem_alloc
#define EXMEM_BUFFER_SIZE (1024*1024*2)        // desired amount of exmem memory to allocate

In wrappers.c
Code: [Select]
#ifdef OPT_EXMEM_MALLOC
...
#ifndef EXMEM_HEAP_SKIP
#define EXMEM_HEAP_SKIP 0
#endif
#ifndef EXMEM_BUFFER_SIZE
#define EXMEM_BUFFER_SIZE (1024*1024*2) // default size if not specified by camera
#endif
#define EXMEM_HEAP_SIZE (EXMEM_BUFFER_SIZE+EXMEM_HEAP_SKIP) // desired space + amount to skip for the movie buffers (if needed)
...
void exmem_malloc_init() {
...
exmem_heap = suba_init(mem,EXMEM_HEAP_SIZE-EXMEM_HEAP_SKIP,1,1024);
...
}

Hope this makes sense,
Phil.
« Last Edit: 19 / February / 2011, 18:33:19 by philmoz »
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

Re: experimental alternate memory allocation
« Reply #74 on: 20 / February / 2011, 04:48:50 »
>I took over 1300 photos and videos on the SX30 with the EXMEM memory manager enabled, and had no >problems. I also had this enabled on the G12 and did not have any problems until another bug surfaced >that forced me to turn off CHDK on the G12.

I get problem with my Camera when use zebra mode and i have

   #undef CAM_ZEBRA_NOBUF

because main reason to use exmem is for me to get zebra buffer.

but as soon i switch to record mode and have zebra view enable, and i call then memory information, of chdk, i have 0 kb free.strange.maybe the new exmem handler have a alloc bug.

Have you test if you get zebra working ok on your camera, when it use a buffer ?
normaly zebra buffer use only around 290 kb

with 0 kb free of course, the camera crash sooner or later.
I have 2.2 megabyte free, and i have no memory leaks, it stay constant, during long shooting session, and when i use no zebra view or use zebra with nobuff, then i never every notice a crash since readfastdir fix.

But i want use Zebra with buffers. ;-)



EDIT:

I test your code, your values work on Ixus 1000 same ways as my, but  i get then 1.1 megabyte free mem.thats also enough.
but when use zebra buffer, free mem drop to 0.

In 16:9 mode zebra view look ok with nobuf.
so strange what cause this 0 mem free problem.

when you do in shoot mode, show memory info and see size 0, then you can switch off camera corect, so there is no risc to test.but you should not call any script, this let camera crash.
« Last Edit: 20 / February / 2011, 05:09:12 by Bernd R »
Ixus 1000 HS

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: experimental alternate memory allocation
« Reply #75 on: 20 / February / 2011, 05:29:11 »
But i want use Zebra with buffers. ;-)

EDIT:

I test your code, your values work on Ixus 1000 same ways as my, but  i get then 1.1 megabyte free mem.thats also enough.
but when use zebra buffer, free mem drop to 0.

In 16:9 mode zebra view look ok with nobuf.
so strange what cause this 0 mem free problem.

when you do in shoot mode, show memory info and see size 0, then you can switch off camera corect, so there is no risc to test.but you should not call any script, this let camera crash.

I have CAM_ZEBRA_NOBUF defined for the SX30 but not for the G12.
Zebra works fine on both although I have not actually checked the free memory while it's enabled.

I'll do some more testing and let you know.

Regards,
Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

Re: experimental alternate memory allocation
« Reply #76 on: 20 / February / 2011, 06:08:36 »
But i want use Zebra with buffers. ;-)

EDIT:

I test your code, your values work on Ixus 1000 same ways as my, but  i get then 1.1 megabyte free mem.thats also enough.
but when use zebra buffer, free mem drop to 0.

In 16:9 mode zebra view look ok with nobuf.
so strange what cause this 0 mem free problem.

when you do in shoot mode, show memory info and see size 0, then you can switch off camera corect, so there is no risc to test.but you should not call any script, this let camera crash.

I have CAM_ZEBRA_NOBUF defined for the SX30 but not for the G12.
Zebra works fine on both although I have not actually checked the free memory while it's enabled.

I'll do some more testing and let you know.

Regards,
Phil.


to test please do a focus or shoot, so zebra is show, and then look in free memory.
camera work good even if 0 kb free.you can shoot, go to chdk menu etc, only features that need more mem, on chdk let camera crash, for example execute a script, or filebrowser

but this have nothing to do with the readfastdir crash report earlier
Ixus 1000 HS

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: experimental alternate memory allocation
« Reply #77 on: 20 / February / 2011, 17:15:54 »
to test please do a focus or shoot, so zebra is show, and then look in free memory.
camera work good even if 0 kb free.you can shoot, go to chdk menu etc, only features that need more mem, on chdk let camera crash, for example execute a script, or filebrowser

No problems on the G12 - zebra with buffers works correctly. Free memory does not go to 0 and I can run scripts and use file browser after shooting with zebra enabled.

Still need to test SX30.

Regards,
Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

Re: experimental alternate memory allocation
« Reply #78 on: 21 / February / 2011, 02:54:46 »
to test please do a focus or shoot, so zebra is show, and then look in free memory.
camera work good even if 0 kb free.you can shoot, go to chdk menu etc, only features that need more mem, on chdk let camera crash, for example execute a script, or filebrowser

No problems on the G12 - zebra with buffers works correctly. Free memory does not go to 0 and I can run scripts and use file browser after shooting with zebra enabled.

Still need to test SX30.

Regards,
Phil.


thanks for testing, if you have CAM_ZEBRA_NOBUF not define for SX30 then you need not test, because CAM_ZEBRA_NOBUF work always on my camera

i like to use the buffer, if possible.
but if it work on your Camera ok, then its only on my camera, and i have no knowledge to fix that , so i must live without buffer

« Last Edit: 22 / February / 2011, 14:15:59 by Bernd R »
Ixus 1000 HS

*

Offline f_m_b

  • **
  • 71
Re: experimental alternate memory allocation
« Reply #79 on: 06 / March / 2011, 12:55:39 »
Hello everybody

this project looks very interesting to me.
I have a SX20 wich are not pleased with lot of memory.

So, if i had understood well this discussion, we are looking for free unused memory regions on the cam and use this instead of the origin heap.
How could it be, that the cam has free memory regions and canon doesn't use it? ???

I have some skills with c, but my asm knowledge lies long years behind me ;-).
Can you give me some hints to find those memory regions? What tools you are using?

Thanks a lot
Frank

Greetings Frank
SX20 (1.02b)

 

Related Topics


SimplePortal © 2008-2014, SimplePortal