Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
34 user(s) are online (24 user(s) are browsing Forums)

Members: 0
Guests: 34

more...

Support us!

Headlines

Report message:*
 

Extended Memory (and just a memory) questions

Subject: Extended Memory (and just a memory) questions
by kas1e on 2019/8/16 15:44:39

Hi all !

Is there ppls who for real use Extended Memory ? As far as i aware its only broadblues with Sketchblock use it , so maybe question is mostly to him :)

So, i currently have some app, which have that kind of memory alloc/free functions:

#include <stdlib.h>
#include <string.h>

#include "main.h"

void *myzalloc_ (uint32_t size,
                 const 
char *what,
                 const 
char *file,
                 const 
char *func,
                 const 
uint32_t line)
{
    
void *ptr malloc(size);

    if (!
ptr) {
        DIE(
"No memory(%u), %s:%s():%u"sizefilefuncline);
    }

    
memset(ptr0size);

#ifdef ENABLE_PTRCHECK
    
ptrcheck_alloc(ptrwhatsizefilefuncline);
#endif

    
return (ptr);
}

void *mymalloc_ (uint32_t size,
                 const 
char *what,
                 const 
char *file,
                 const 
char *func,
                 const 
uint32_t line)
{
    
void *ptr malloc(size);

    if (!
ptr) {
        DIE(
"No memory, %s:%s():%u"filefuncline);
    }

#ifdef ENABLE_PTRCHECK
    
ptrcheck_alloc(ptrwhatsizefilefuncline);
#endif

    
return (ptr);
}

void *myrealloc_ (void *ptr,
                  
uint32_t size,
                  const 
char *what,
                  const 
char *file,
                  const 
char *func,
                  const 
uint32_t line)
{
#ifdef ENABLE_PTRCHECK
    
ptrcheck_free(ptrfilefuncline);
#endif

    
ptr realloc(ptrsize);
    if (!
ptr) {
        DIE(
"No memory, %s:%s():%u"filefuncline);
    }

#ifdef ENABLE_PTRCHECK
    
ptrcheck_alloc(ptrwhatsizefilefuncline);
#endif

    
return (ptr);
}

void myfree_ (void *ptr,
              const 
char *file,
              const 
char *func,
              const 
uint32_t line)
{
#ifdef ENABLE_PTRCHECK
    
ptrcheck_free(ptrfilefuncline);
#endif

    
free(ptr);
}

char *dupstr_ (const char *in,
               const 
char *what,
               const 
char *file,
               const 
char *func,
               const 
uint32_t line)
{
    if (!
in) {
        
ERR("no string to duplicate");
        return (
0);
    }

    
char *ptr strdup(in);
#ifdef ENABLE_PTRCHECK
    
uint32_t size = (typeof(size)) strlen(in);
#endif

    
if (!ptr) {
        DIE(
"No memory, %s:%s():%u"filefuncline);
    }

#ifdef ENABLE_PTRCHECK
    
ptrcheck_alloc(ptrwhatsizefilefuncline);
#endif

    
return (ptr);
}


The app in question, offten want to allocate 1.3gb , or 1.5gb, or 1gb. Which, in our limitation with 32bit and amigaos, when i have on running already eated about 250mb , leave us with less that 1.5gb.

I write some simple test case and found, that i can only allocate just about ~1.4gb on one malloc, while i have 250 mb free. So in summ its just 1.650 in whole , but its already barier to burn and crash. So its of course not 2gb (as 31 bit addressing), but even not 1.8gb, but ~1.7gb of memory which can be used under aos4 :)


So, question, can i use that Extended Memory thing, to just add relevant code in those helpers myalloc() and myfree() functions, so, they will just works as it, but just will have ability to alloc and 1.5gb via malloc, and 2gb and whatever extendent memory can handle.

At least for me will be enough to have ability to alloc 1.7gb at one push, so leave aos4 with 300 mb used, but currently limited to ~1.4gb.

Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project