Shop OBEX P1 Docs P2 Docs Learn Events
Remaining memory........ — Parallax Forums

Remaining memory........

Does any one know how to get the remaining memory available (in P1) for the main memory and each cog ??

Also, does any one know if there are any memory leaks when using the SimpleIDE/GCC compiler ??

Comments

  • AwesomeCronkAwesomeCronk Posts: 1,055
    edited 2020-10-26 18:50
    Memory leaks are most often caused by your code continually gathering data without getting rid of old data. For example, forgetting to clear a buffer every x number of cycles. Bugs in the compiler can occasionally cause them, but they would render the compiler useless if they happened every time you used the compiler.
  • What's preventing you from using it? Can you give us more details on your problem?
  • Could be mistaken, but I think s/he is asking if there's a 'memfree()' function?
  • Cluso99Cluso99 Posts: 18,069
    Any memory leaks from the compiler would not affect the P1s memory.

    I am not familiar with SimpleIDE or GCC so cannot help with P1 memory usage. Homespun and bst compilers have listing outputs so you can see what’s being used.

    PropTool gives you hub usage. Spin programs use all the cog memory for the spin interpreter.

    For pasm cogs, you can use the fit statement and adjust down until it fails but it’s a slow iterative process.

    We need more info to help further.
  • Clock LoopClock Loop Posts: 2,069
    edited 2020-10-27 01:47
    I don't know if a c function has been created somewhere to determine cog ram or hub ram availability.. but....

    SimpleIDE tells you your code size in bytes, in the bottom left corner of the program once you compile.
    Subtract 32KB from your code size?
    320 x 34 - 6K
  • Dave HeinDave Hein Posts: 6,347
    edited 2020-10-27 02:17
    @bitnerd , do you want to know how much stack space and heap space you have? Is that what you are asking? When I did my threaded chess program I wrote some routines that would tell me how much of the the stack I used in the main stack as well as in the extra cog stacks. I also had a routine that would compute the amount of free memory available by taking the difference between the address of a local stack variable and the address returned by mallocing a few bytes. I can dredge up those routines and post them if that's what you need.

    As far as memory leaks, I am not aware of any memory leaks in PropGCC's heap manager. Is that what you are asking about?
Sign In or Register to comment.