UnQLite Users Forum

Out of memory for unqlite_util_load_mmaped_file

append delete shiva

I am trying to store a file in the database. But, I am getting this return value Out of memory (-1) for the function call unqlite_util_load_mmaped_file.
(I am using Ubuntu and building for the localhost)
What can I do to solve this problem.

Code sample

--------------------------------------------------

rc = unqlite_util_load_mmaped_file(payload,&pMap,&payload_len);
if( rc == UNQLITE_OK )
{
/* Store the whole file */
rc = unqlite_kv_store(pDb,pkey,-1,pMap,payload_len);
/* Discard this view */
if( rc != UNQLITE_OK )
{
Fatal(app_unqlite_st_ptr->pDb,"");
return 0;
}
else
{
unqlite_util_release_mmaped_file(pMap,payload_len);
printf("\n FILE stored in Application Partition \n");
}
}
else
{
printf("\n PersistenceLayer_Entry_Store: Obtaining read-only memory view of the target file failed : %d\n", rc);
Fatal(app_unqlite_st_ptr->pDb,"");
return 0;
}

:: @shiva added on 12 Oct ’15 · 12:19

I would like to add that the program is working only when the executable is placed in the same folder in which the file to be stored in the database is present. If the file to be stored is in another path it throws the error - Out Of Memory

Reply RSS

Replies

append delete #1. chm

Make sure that payload is a valid pathname i.e. /usr/home/something.txt and the file size should not exceed 4GB on 32-bit system especially if the system is not compiled with large file storage.

append delete #2. shiva

Thank you for the answer.

Reply

(Leave this as-is, it’s a trap!)

There is no need to “register”, just enter the same name + password of your choice every time.

Pro tip: Use markup to add links, quotes and more.

Your friendly neighbourhood moderators: chm_at_symisc, devel_at_symisc