×

Discussion Board

Results 1 to 13 of 13
  1. #1
    Registered User
    Join Date
    Jul 2003
    Posts
    5

    RMS deleteRecord in 7210

    Hello,
    What is the behaviour of the 7210 about RMS ?
    Why deleteRecord function doesn't work ?
    I need to delete a record form recordStore without switch off the device : this is a really serious problem for developping applications and games.
    I'm grateful for all you've gave me.

    Gaetan

  2. #2
    Registered User
    Join Date
    Jul 2003
    Location
    Finland, Tampere
    Posts
    1,113
    I hope you don't forget to close Storage after deleting record.

  3. #3
    Registered User
    Join Date
    Jul 2003
    Posts
    5
    Yes, the record store has been closed.

    try this :

    RecordStore my_RecordStore = null;

    try
    {
    System.out.println("Create new empty record store");
    my_RecordStore = RecordStore.openRecordStore("my_RecordStore",true);
    System.out.println(" Size available = "+my_RecordStore.getSizeAvailable());
    }catch(Exception e){return;}

    byte data []= {0,1,2,3};
    int id_record = -1;

    try
    {
    id_record = my_RecordStore.addRecord(data,0,data.length);
    my_RecordStore.closeRecordStore();

    System.out.println("Open not empty record store");
    my_RecordStore = RecordStore.openRecordStore("my_RecordStore",true);
    System.out.println(" Size available = "+my_RecordStore.getSizeAvailable());
    my_RecordStore.closeRecordStore();

    }catch(Exception e){return;}

    try
    {
    my_RecordStore = RecordStore.openRecordStore("my_RecordStore",false);
    System.out.println("Delete record in record store");
    my_RecordStore.deleteRecord(id_record);
    my_RecordStore.closeRecordStore();
    }catch(Exception e){return;}

    try
    {
    my_RecordStore = RecordStore.openRecordStore("my_RecordStore",false);
    int num_record = my_RecordStore.getNumRecords();
    System.out.println("How many record in record store = "+num_record);
    System.out.println(" Size available = "+my_RecordStore.getSizeAvailable());
    my_RecordStore.closeRecordStore();
    }catch(Exception e){return;}



    The result =
    Create new empty record store

    Size available = 20400

    Open not empty record store

    Size available = 20380

    Delete record in record store

    How many record in record store = 0

    Size available = 20380


    SO where are the 20 bytes free by the delete record ?
    You can test this code in the handset, the result is the same.
    My conclusion is that the RMS (Record Management Store) is bugged.

    Some people said :the size available gave by the device is fault, the record is really deleted but the size isn't update.
    I say OK, but try to fill the memory , delete a record and add a new one => A recordStoreExceptionFull became.

    Can anyone check his bug ?
    Thanks for response.

  4. #4
    Registered User
    Join Date
    Jul 2003
    Location
    Finland, Tampere
    Posts
    1,113
    I would imagine that RecordStore records are also subject for garbage collection. Maybe record is logically deleted, but memory is physically freed only when needed or when you call gc().

    Try your example with record of size close to the maximum. Then try to add big record again.

    If this does'nt help, try calling gc() before second addition.

  5. #5
    Registered User
    Join Date
    Jul 2003
    Posts
    5
    Negative ....
    Call gc doen't change anything !

    I will try on device.

    I've found an alternative for counter delete record = i replace record by record store. (I think the number of record store is limited, could you know this limit ?)

    Thanks a lot.

  6. #6
    Registered User
    Join Date
    Jul 2003
    Location
    Finland, Tampere
    Posts
    1,113
    In fact it might be a task for some phone-controlled gc().

    Try saving large file(more then half RMS space), then deleting, then saving again.

    Maybe this "free space" is rather virtual thing.

    Also why do you need to care about it? Are you going to constantly save and delete hundreds of big records?

  7. #7
    Registered User
    Join Date
    Jul 2003
    Posts
    5
    It's the end of the journey for me.
    Free space isn't virtual thing (in emulator) i doesn't test it on device actually.

    My goal is to use RMS as memory to avoid Conflicting stack size or Out of memory.

  8. #8
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395
    Gaetan,

    I have experienced the same thing... I might delete several records, and free no space. It really isn't freed... I can get a RecordStoreFullException. even though I know there is enough free space to store the new record (enough 'real' free space, not the reported free size). I might delete another record later, and all the space will free in one go.

    I have not been able to reproduce this reliably, so I'm glad that you have, and proven that I wasn't imagining things!!!!

    It seems to work better if I close the RS after each update action... though the documentation makes no suggestion that this should be necessary. However, I then experience the more sinister problem of my phone (Nokia 6100) rebooting!!! (See J2ME General - RMS headache).

    I think you are correct - there are serious bugs in RMS. I am becoming worried that if you want to create and delete reasonably large records with any frequency, RMS may be unusable.

    Smaller records may cause less problem than large records, so it would be possible to break records up. But: my tests show that RMS performance on Nokia Series 40 is a function of number of records, not number of bytes, so many small records makes the performance drop by orders of magnitude!!

    Possibly, it may be necessary not to delete records, but just set them to length of zero (rs.setRecord (i, null, 0, 0)), then re-use the record at a later time rather than adding new records all the time.

    Graham.

  9. #9
    Registered User
    Join Date
    Mar 2003
    Posts
    4
    Found out that the memoryleak problem on a 7650 from my former post comes from the rms too.
    Hmm ...not only an anoying but can turns out to be realy expensive one too.
    It can fill the whole memory and force you to reset the whole system at the service center. Happend now the third time. Wasnt happy about that.
    Anyone asked sun???
    BTW; When you delete the whole app and reinstall it again the memory is freed. (sometimes you have to do this progress 2 times to see the result) I know this is not a solutuin but Worked for me.

    Cheers

  10. #10
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395
    All,

    I can't find an official means of reporting bugs to Nokia, so I have written to the forum-helpdesk to ask how I should do this. I have mentioned problems with RMS (deletes don't delete, deletes don't free space and phone reboots on Series 40, memory leak on 7650) and also a problem someone else has mentioned to me with reboots resulting from graphics methods on Series 40. These problems are all potential show-stoppers for our development projects.

    I've expended a lot of effort trying to track my RMS problems, and I know you all have too. Without an adequate understanding of the mechanics behind the API, it's going to take us a long time to find the best work-around, and I for one am not going to be very confident in any work-around I find purely by trial-and-error.

    I'll let you know what response I get.

    Cheers,
    Graham.

  11. #11
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395
    No reply from Nokia. Perhaps you can't report bugs, without paying 400 euros for the privelage!!

    I seem to have solved my immediate problems by storing each record in a separate recordstore (!!), which I can (so far!) create and delete without problem.

    Interestingly, all the sample RMS code I can find from Nokia only creates - never deletes - records. Coincidence, perhaps....

  12. #12
    Registered User
    Join Date
    Mar 2003
    Posts
    20
    Can you say more about the Series 40 graphics bugs?

    > ... also a problem someone else has mentioned to me with
    > reboots resulting from graphics methods on Series 40.

  13. #13
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395
    The problem involved drawString() method called from within paint(). It turns out that the device in question may be a pre-release model.

    I can't personally report any graphics problems, other than an inexplicable NullPointerException from drawChars() on the 7210 emulator (I don't know if this occurs on a real device, as I had to add code to catch and ignore it so I could test the rest of the code - everything works fine, so I've left it there!).

    Graham.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •